- changed status to resolved
Initialize record inside another object
Issue #96
resolved
When we initialize a record inside an object
type
TRec2 = record
plot : String; external 'plot';
writer : String; external 'writer';
upvotes: Integer; external 'upvotes';
end;
var rec : variant;
rec:= new JObject;
rec.data := record
estoria: TRec2 = (plot: "I crashed my car today!"; writer: "warleyX"; upvotes: 28); external 'story';
end;
the compiler will emit this piece of code:
function Pub$xR1($) {
return {
"story" : Pub$d6e($.story)
}
}
qHe = {};
qHe.data = Pub$xR1({story:{plot:"I crashed my car today!",writer:"Alex",upvotes:28}});
uhm... the compiler didn't define the Pub$d6e method.
... but if we declare an object using another approach:
var rec : variant;
rec:= new JObject;
rec["data"] := record
estoria: TRec2 = (plot: "I crashed my car today!"; writer: "warleyX"; upvotes: 28); external 'story';
end;
the compiler will emit the correct output :)
jtD = {};
jtD["data"] = {story:{plot:"I crashed my car today!",writer:"warleyX",upvotes:28}};
Comments (2)
-
repo owner -
repo owner Several issues were combining here: * smart-linker was removing ignoring the field because it was not used, it will no longer do that for published & external fields * record clone was invoking Pub$ for published members, without checking that there are published members (in which case, Pub$ is not generated), it will no longer do that
Also made some extra commits to have anonymous be flagged as external by default
- Log in to comment
Fixed Issue
#96→ <<cset 6b6741619263>>