Example:
class Example {
baz = 3;
foo() {
(this["bar"])()
}
bar() {
return this.baz;
}
}
const inst = new Example();
print(inst.foo())
Translates to (annotated with commentary):
Example = __TS__Class()
Example.name = "Example"
function Example.prototype.____constructor(self)
self.baz = 3
end
function Example.prototype.foo(self)
self.bar(nil) -- NOTE: This nil should actually be 'self'
end
function Example.prototype.bar(self)
return self.baz -- Nil reference exception here
end
Playground link
Verified this in JS and it works fine there.
Example:
Translates to (annotated with commentary):
Playground link
Verified this in JS and it works fine there.