Skip to content
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] - Add early errors for escaped identifiers #2546

Closed
wants to merge 2 commits into from

Conversation

raskad
Copy link
Member

@raskad raskad commented Jan 20, 2023

This Pull Request changes the following:

  • Add early errors for escaped characters in object and class setters and getters.
  • Add early errors for escaped characters in class static.
  • Add early errors for escaped characters in new.target.
  • Add early errors for legacy octal/decial escapes that are used in string literals before a "use strict" directive.

@raskad raskad added bug Something isn't working parser Issues surrounding the parser labels Jan 20, 2023
@raskad raskad added this to the v0.17.0 milestone Jan 20, 2023
@github-actions
Copy link

github-actions bot commented Jan 20, 2023

Test262 conformance changes

Test result main count PR count difference
Total 94,205 94,205 0
Passed 70,686 70,716 +30
Ignored 18,622 18,622 0
Failed 4,897 4,867 -30
Panics 0 0 0
Conformance 75.03% 75.07% +0.03%
Fixed tests (30):
test/language/literals/string/legacy-non-octal-escape-sequence-4-strict-explicit-pragma.js (previously Failed)
test/language/literals/string/legacy-non-octal-escape-sequence-2-strict-explicit-pragma.js (previously Failed)
test/language/literals/string/legacy-non-octal-escape-sequence-5-strict-explicit-pragma.js (previously Failed)
test/language/literals/string/legacy-non-octal-escape-sequence-8-strict-explicit-pragma.js (previously Failed)
test/language/literals/string/legacy-non-octal-escape-sequence-3-strict-explicit-pragma.js (previously Failed)
test/language/literals/string/legacy-octal-escape-sequence-prologue-strict.js (previously Failed)
test/language/literals/string/legacy-non-octal-escape-sequence-9-strict-explicit-pragma.js (previously Failed)
test/language/literals/string/legacy-non-octal-escape-sequence-1-strict-explicit-pragma.js (previously Failed)
test/language/literals/string/legacy-non-octal-escape-sequence-7-strict-explicit-pragma.js (previously Failed)
test/language/literals/string/legacy-non-octal-escape-sequence-6-strict-explicit-pragma.js (previously Failed)
test/language/expressions/new.target/escaped-target.js [strict mode] (previously Failed)
test/language/expressions/new.target/escaped-target.js (previously Failed)
test/language/expressions/object/method-definition/escaped-get-g.js [strict mode] (previously Failed)
test/language/expressions/object/method-definition/escaped-get-g.js (previously Failed)
test/language/expressions/object/method-definition/escaped-set.js [strict mode] (previously Failed)
test/language/expressions/object/method-definition/escaped-set.js (previously Failed)
test/language/expressions/object/method-definition/escaped-get.js [strict mode] (previously Failed)
test/language/expressions/object/method-definition/escaped-get.js (previously Failed)
test/language/expressions/object/method-definition/escaped-set-t.js [strict mode] (previously Failed)
test/language/expressions/object/method-definition/escaped-set-t.js (previously Failed)
test/language/expressions/object/method-definition/escaped-set-e.js [strict mode] (previously Failed)
test/language/expressions/object/method-definition/escaped-set-e.js (previously Failed)
test/language/expressions/object/method-definition/escaped-set-s.js [strict mode] (previously Failed)
test/language/expressions/object/method-definition/escaped-set-s.js (previously Failed)
test/language/expressions/object/method-definition/escaped-get-t.js [strict mode] (previously Failed)
test/language/expressions/object/method-definition/escaped-get-t.js (previously Failed)
test/language/expressions/object/method-definition/escaped-get-e.js [strict mode] (previously Failed)
test/language/expressions/object/method-definition/escaped-get-e.js (previously Failed)
test/language/statements/class/syntax/escaped-static.js [strict mode] (previously Failed)
test/language/statements/class/syntax/escaped-static.js (previously Failed)

@codecov
Copy link

codecov bot commented Jan 20, 2023

Codecov Report

Merging #2546 (f056e40) into main (097f85e) will decrease coverage by 0.04%.
The diff coverage is 50.43%.

@@            Coverage Diff             @@
##             main    #2546      +/-   ##
==========================================
- Coverage   50.07%   50.03%   -0.04%     
==========================================
  Files         379      379              
  Lines       37763    37836      +73     
==========================================
+ Hits        18908    18930      +22     
- Misses      18855    18906      +51     
Impacted Files Coverage Δ
...c/parser/expression/left_hand_side/optional/mod.rs 79.68% <ø> (ø)
.../statement/declaration/hoistable/class_decl/mod.rs 51.51% <17.14%> (-0.86%) ⬇️
boa_parser/src/parser/statement/mod.rs 65.32% <28.57%> (-1.35%) ⬇️
...ser/src/parser/expression/left_hand_side/member.rs 47.54% <37.50%> (-1.18%) ⬇️
...arser/expression/primary/object_initializer/mod.rs 64.63% <50.00%> (-0.71%) ⬇️
boa_parser/src/lexer/token.rs 52.38% <80.00%> (ø)
boa_parser/src/lexer/string.rs 82.51% <84.00%> (+0.50%) ⬆️
boa_parser/src/lexer/identifier.rs 95.91% <100.00%> (+0.17%) ⬆️
boa_parser/src/lexer/template.rs 82.45% <100.00%> (ø)
boa_parser/src/parser/expression/identifiers.rs 55.43% <100.00%> (ø)
... and 7 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! Just a small comment to improve readability.

@@ -99,7 +99,7 @@ pub enum TokenKind {
EOF,

/// An identifier.
Identifier(Sym),
Identifier((Sym, bool)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to have a IsLegacyEscaped enum instead of bool, because there are a lot of places where it is not obvious what the bool represents exactly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, I added explicit types instead of the bools.

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Copy link
Member

@nekevss nekevss left a 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 😄

@raskad
Copy link
Member Author

raskad commented Jan 28, 2023

bors r+

bors bot pushed a commit that referenced this pull request Jan 28, 2023
This Pull Request changes the following:

- Add early errors for escaped characters in object and class setters and getters.
- Add early errors for escaped characters in class `static`.
- Add early errors for escaped characters in `new.target`.
- Add early errors for legacy octal/decial escapes that are used in string literals before a `"use strict"` directive.
@bors
Copy link

bors bot commented Jan 28, 2023

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Add early errors for escaped identifiers [Merged by Bors] - Add early errors for escaped identifiers Jan 28, 2023
@bors bors bot closed this Jan 28, 2023
@bors bors bot deleted the early-errors-escapes branch January 28, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser Issues surrounding the parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants