Description
We're using this pattern in the compiler:
class VarMember {
abstract String get name();
...
}
class VarFunctionStub extends VarMember {
final String name;
...
}
The code generated for this is incorrect. It tries to create a "name" property on VarMember, which looks like:
Object.defineProperty(VarMember.prototype, "name", {
get: VarMember.prototype.get$name,
});
Except get$name doesn't exist on the base class. Also, this prevents the setters on the derived classes from working (e.g. "this.name = name;" in VarFunctionStub ctor).
At this point you might be wondering: why isn't the self-hosted compiler currently broken? It is not broken! Probably because we don't use ".name" dynamically. This bug is only triggered when the compiler is used in the same codebase as DOM (or html?) libraries.
Activity
vsmenon commentedon Nov 10, 2011
I'm seeing similar problems when the getter is not abstract:
class A {
int get x() => null;
}
class B extends A {
int x;
}
Setting the value x in the derived class is not working for me.
dgrove commentedon Nov 29, 2011
Added this to the FrogEditor milestone.
dgrove commentedon Nov 30, 2011
as of r1908, both of these examples are working correctly.
Added Fixed label.
implement null aware ops, fixes #249