You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find it's surprisingly easy, when coding along and concentrating on other things, to create a class and then try to add a method this way:
self.foo = function
// do some stuff
end function
And when you do this, you get a poor error message: "Runtime Error: can't set indexed element of null". What's worse, if this occurs in the main file, the stackTrace is empty — and if it occurs in an import module, it will claim the error is on the import line!
Curiously, trying to assign to super.foo produces a better error ("Undefined Identifier: 'super' is unknown in this context").
So:
Catch trying to use self. when self is undefined, and print a better error message. Ideal might be something like "self undefined; not in object context"
Ensure that the line number is correctly reported, both in the main file and in an import module.
The text was updated successfully, but these errors were encountered:
I find it's surprisingly easy, when coding along and concentrating on other things, to create a class and then try to add a method this way:
And when you do this, you get a poor error message: "Runtime Error: can't set indexed element of null". What's worse, if this occurs in the main file, the
stackTrace
is empty — and if it occurs in an import module, it will claim the error is on theimport
line!Curiously, trying to assign to
super.foo
produces a better error ("Undefined Identifier: 'super' is unknown in this context").So:
self.
when self is undefined, and print a better error message. Ideal might be something like "self
undefined; not in object context"The text was updated successfully, but these errors were encountered: