-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
[Merged by Bors] - Fix unreachable panics in compile_access #1861
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1861 +/- ##
==========================================
- Coverage 46.41% 46.39% -0.03%
==========================================
Files 206 206
Lines 16790 16813 +23
==========================================
+ Hits 7793 7800 +7
- Misses 8997 9013 +16
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! Just some dbg
leftovers
boa_engine/src/tests.rs
Outdated
let mut context = Context::default(); | ||
|
||
let test_cases = [ | ||
"(()=>{})() -= 5", | ||
"(()=>{})() *= 5", | ||
"(()=>{})() /= 5", | ||
"(()=>{})() %= 5", | ||
"(()=>{})() &= 5", | ||
"(()=>{})() ^= 5", | ||
"(()=>{})() |= 5", | ||
"(()=>{})() += 5", | ||
"(()=>{})() = 5", | ||
]; | ||
|
||
for case in &test_cases { | ||
let string = forward(&mut context, case); | ||
|
||
assert!(string.starts_with("Uncaught \"SyntaxError\": ")); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a better way of testing in rust with https://github.com/boa-dev/boa/blob/main/boa_engine/src/lib.rs#L151-L193
Here is an example https://github.com/boa-dev/boa/blob/main/boa_engine/src/tests.rs#L1360-L1368
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll change that over; I was following the pattern I observed with similar test cases.
Yup. These are early errors that should be checked during parsing, and the |
Co-authored-by: jedel1043 <jedel0124@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
bors r+ |
This PR changes the following: - More elegantly handles illegal access statements in compile_access - Adds a slew of previously unhandled illegal access test cases ### Caveats It is very, very likely that you will want to simply restrict unary and assignment operations in the AST. However, this prevents crashes in the meantime with a error that is just slightly less detailed than if it were implemented in AST.
Pull request successfully merged into main. Build succeeded: |
This PR changes the following:
Caveats
It is very, very likely that you will want to simply restrict unary and assignment operations in the AST. However, this prevents crashes in the meantime with a error that is just slightly less detailed than if it were implemented in AST.