Open
Description
In the below I'd expect s.F1 = "foo"
to compile to s.Object.t1.Object.f1 = "foo"
, but instead it seems to compile to s.Object.t1 = "foo"
. In the marked assignment ("error here"), running in Node I get "TypeError: Cannot create property 'f1' on string 'foo'"; in Chrome with similar code I get a similar error. (The playground behaves differently -- it doesn't error, but it doesn't get it right, either).
type T1 struct {
*js.Object
F1 string `js:"f1"`
}
s := &struct {
*js.Object
*T1 `js:"t1"`
}{Object: hvue.NewObject()}
s.T1 = &T1{Object: hvue.NewObject()}
s.F1 = "foo"
println("s.F1:", s.F1)
println("s.T1.F1:", s.T1.F1)
s.T1.F1 = "bar" // <- error here
This code compiles as
s = new structType.ptr(hvue.NewObject(), ptrType.nil);
s.Object.t1 = $externalize(new T1.ptr(hvue.NewObject(), ""), ptrType);
s.Object.t1 = $externalize("foo", $String); // <- This is wrong
console.log("s.F1:", $internalize(s.Object.t1, $String));
console.log("s.T1.F1:", $internalize($internalize(s.Object.t1, ptrType).Object.f1, $String));
$internalize(s.Object.t1, ptrType).Object.f1 = $externalize("bar", $String);
Am I doing something wrong and/or unsupported?
Metadata
Metadata
Assignees
Labels
No labels