Closed enochii closed 3 years ago
Actually you can see some conflicts between lexical scope and the rule of class field access. Here gives a snippet:
var str = "global";
class A{
f() {
println str;
}
}
var a = A();
a.str = "instance field";
Maybe you can also read this Chinese blog in which I have some discussion about this problem.
I think this one is easy? just hack the current
LoxInstance.set()
. When a set is triggered, the field will be added toinstEnv
.