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
For anyone willing to work on this, this has two sides:
implemented in here for identifiers execution. This will go to the Realm environment record and call get_binding_value(). This will either return the value, or Undefined.
This is not 100% spec compliant. The spec says that this should call the "abstract" operation ResolveBinding, with no environment pre-set. Then, this should call to GetIdentifierReference (Note that Boa doesn't implement strict mode yet). We currently don't have Reference implemented, either, so, the current implementation does a fine job returning an undefined, but we lack information on the binding name. The main issue here, is that we should be calling GetValue on this returned reference, if I'm not mistaken.
As we can see in the formal specification of this function, we should throw a ReferenceError if the value is not defined. Ideally, we should implement Reference and its get_value() function that would be 100% spec compliant.
Note that this type of error is not implemented in Boa yet, and we only have the general Error, the TypeError and the RangeError, as you can see here.
To implement a new one, you can base your implementation in the RangeError implementation, for example, and then add a helper to the interpreter in the exceptions list to easily throw one if needed.
A bit of extra information about ReferenceError can be found in the spec.
About the calling of an undefined variable, is implemented here. This is calling interpreter.call, which is implemented here with its spec here. This is not spec compliant, but we can improve it greatly, and even make it spec compliant. It should first not check func to se if it's callable, since we recently implemented is_callable() on values. This should throw a TypeError, not panic, in the case that the value is not callable.
But we are missing here the ReferenceError. This is coming from here, from the second part, that does CallExpression: CallExpression Arguments. Here, when we evaluate the call expression, we get the undefined d Reference, and should be calling get_value() on it, which should throw the ReferenceError.
I think we should first fix the d; case by implementing Reference and get_value(), and then, fix the Call implementation.
Describe the bug
Any of the above statements should throw an error
ReferenceError: d is not defined
The text was updated successfully, but these errors were encountered: