There were some bugs about setting resource fields that were structs with various fields. This makes things more strict and correct. Now we check for duplicate field names earlier (duplicates due to identical aliases) and we also don't try and set private fields, or incorrectly set partial structs. Most interestingly, this also cleans up all of the resources and ensures that each one has nicer docs and a clear struct tag for fields that we want to use in mcl. These are mandatory now, and if you're missing the tag, then we will ignore the field.
23 lines
456 B
Plaintext
23 lines
456 B
Plaintext
-- main.mcl --
|
|
$st0 struct{x str} = struct{x => "hello",}
|
|
test structlookup($st0, "x") {}
|
|
|
|
$st1 = struct{y => "world",}
|
|
test structlookup($st1, "y") {}
|
|
|
|
$st2 = struct{x => true, y => 42, z => "hello world",}
|
|
test structlookup($st2, "z") {}
|
|
test "foo" {
|
|
mixedstruct => struct{
|
|
somebool => true,
|
|
somestr => "hi",
|
|
someint => 42,
|
|
somefloat => 1.0,
|
|
},
|
|
}
|
|
-- OUTPUT --
|
|
Vertex: test[foo]
|
|
Vertex: test[hello world]
|
|
Vertex: test[hello]
|
|
Vertex: test[world]
|