-
-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panic when using unary operations on this
#2416
Comments
This is only disallowed for specifically the unary operations which would assign to UnaryOp::DecrementPost => {
// TODO: promote to an early error.
let access = Access::from_expression(unary.target()).ok_or_else(|| {
JsNativeError::syntax().with_message("Invalid decrement operand")
})?; To something like this: UnaryOp::DecrementPost => {
// TODO: promote to an early error.
let access = Access::from_expression(unary.target())
.filter(|a| a != Access::This)
.ok_or_else(|| {
JsNativeError::syntax().with_message("Invalid decrement operand")
})?; For anyone more knowledgeable, does this seem to be correct? |
It is correct, but I would very much prefer if we moved the error to the parser. |
Hi, can I work on this issue? |
@veera-sivarajan Seems like @e-codes-stuff was checking out the issue, so maybe they have some WIP fix? |
No WIP fix here aside from the code I posted above which just adds a method
call to something that should be moved into the parser
|
With this fixed, there are currently no bugs found by the fuzzer with implied oracles. Huzzah! |
Describe the bug
Using a unary operator on
this
causes boa to panic.To Reproduce
Execute the following script:
Which causes the following error:
Expected behavior
Boa should issue a syntax error with an invalid operand.
Additional context
Discovered by #2401
The text was updated successfully, but these errors were encountered: