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

Allow arguments and eval in the return position of strict functions #1836

Closed
wants to merge 2 commits into from

Conversation

am-a-man
Copy link
Contributor

This Pull Request fixes/closes #1598 .

It changes the following:

  • updated STRICT_FORBIDDEN_IDENTIFIERS
  • updated LexicalBinding to throw Error when assigning to eval or arguments in strict mode
  • updated VariableDeclaration to throw Error when assigning to eval or arguments in strict mode

@codecov
Copy link

codecov bot commented Feb 13, 2022

Codecov Report

Merging #1836 (e54013d) into main (7b2dc88) will increase coverage by 0.00%.
The diff coverage is 60.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1836   +/-   ##
=======================================
  Coverage   55.71%   55.72%           
=======================================
  Files         201      201           
  Lines       17326    17336   +10     
=======================================
+ Hits         9654     9661    +7     
- Misses       7672     7675    +3     
Impacted Files Coverage Δ
boa/src/syntax/lexer/identifier.rs 61.53% <ø> (ø)
...src/syntax/parser/statement/declaration/lexical.rs 53.21% <40.00%> (-0.64%) ⬇️
boa/src/syntax/parser/statement/variable/mod.rs 68.57% <80.00%> (+2.41%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b2dc88...e54013d. Read the comment docs.

@Razican
Copy link
Member

Razican commented Feb 13, 2022

VM implementation

Test result main count PR count difference
Total 87,912 87,912 0
Passed 40,892 40,851 -41
Ignored 19,929 19,929 0
Failed 27,091 27,132 +41
Panics 0 0 0
Conformance 46.51% 46.47% -0.05%
Fixed tests (26):
test/language/statements/for-of/arguments-unmapped.js (previously Failed)
test/language/statements/for-of/arguments-unmapped-aliasing.js (previously Failed)
test/language/statements/for-of/arguments-unmapped-mutation.js (previously Failed)
test/language/arguments-object/mapped/nonconfigurable-descriptors-define-failure.js (previously Failed)
test/built-ins/Array/prototype/concat/Array.prototype.concat_strict-arguments.js [strict mode] (previously Failed)
test/built-ins/Array/prototype/concat/Array.prototype.concat_strict-arguments.js (previously Failed)
test/built-ins/ArrayIteratorPrototype/next/args-unmapped-expansion-after-exhaustion.js (previously Failed)
test/built-ins/ArrayIteratorPrototype/next/args-unmapped-expansion-before-exhaustion.js (previously Failed)
test/built-ins/ArrayIteratorPrototype/next/args-unmapped-iteration.js (previously Failed)
test/built-ins/ArrayIteratorPrototype/next/args-unmapped-truncation-before-exhaustion.js (previously Failed)
test/built-ins/ThrowTypeError/unique-per-realm-unmapped-args.js [strict mode] (previously Failed)
test/built-ins/ThrowTypeError/unique-per-realm-unmapped-args.js (previously Failed)
test/built-ins/ThrowTypeError/unique-per-realm-non-simple.js [strict mode] (previously Failed)
test/built-ins/ThrowTypeError/unique-per-realm-non-simple.js (previously Failed)
test/built-ins/ThrowTypeError/forbidden-arguments.js [strict mode] (previously Failed)
test/built-ins/ThrowTypeError/forbidden-arguments.js (previously Failed)
test/built-ins/ThrowTypeError/throws-type-error.js [strict mode] (previously Failed)
test/built-ins/ThrowTypeError/throws-type-error.js (previously Failed)
test/built-ins/ThrowTypeError/is-function.js [strict mode] (previously Failed)
test/built-ins/ThrowTypeError/is-function.js (previously Failed)
test/built-ins/ThrowTypeError/forbidden-caller.js [strict mode] (previously Failed)
test/built-ins/ThrowTypeError/forbidden-caller.js (previously Failed)
test/built-ins/ThrowTypeError/length.js [strict mode] (previously Failed)
test/built-ins/ThrowTypeError/length.js (previously Failed)
test/built-ins/ThrowTypeError/prototype.js [strict mode] (previously Failed)
test/built-ins/ThrowTypeError/prototype.js (previously Failed)
Broken tests (67):
test/language/expressions/assignmenttargettype/parenthesized-identifierreference-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/assignmenttargettype/parenthesized-identifierreference-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/assignmenttargettype/direct-identifierreference-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/assignmenttargettype/direct-identifierreference-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/object/setter-param-eval-strict-outside.js [strict mode] (previously Passed)
test/language/expressions/object/11.1.5-1gs.js [strict mode] (previously Passed)
test/language/expressions/object/setter-param-arguments-strict-outside.js [strict mode] (previously Passed)
test/language/expressions/object/method-definition/early-errors-object-method-arguments-in-formal-parameters.js [strict mode] (previously Passed)
test/language/expressions/object/method-definition/early-errors-object-method-eval-in-formal-parameters.js [strict mode] (previously Passed)
test/language/expressions/logical-assignment/lgcl-or-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/logical-assignment/lgcl-and-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/logical-assignment/lgcl-and-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/logical-assignment/lgcl-nullish-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/logical-assignment/lgcl-or-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/logical-assignment/lgcl-nullish-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/mult-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/or-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/and-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/mod-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/sub-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/xor-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/11.13.2-6-1gs.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/add-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/lshift-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/mult-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/or-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/urshift-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/srshift-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/add-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/sub-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/and-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/xor-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/lshift-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/div-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/srshift-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/div-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/mod-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/compound-assignment/urshift-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/async-generator/early-errors-expression-eval-in-formal-parameters.js [strict mode] (previously Passed)
test/language/expressions/async-generator/early-errors-expression-arguments-in-formal-parameters.js [strict mode] (previously Passed)
test/language/expressions/async-function/early-errors-expression-eval-in-formal-parameters.js [strict mode] (previously Passed)
test/language/expressions/assignment/id-arguments-strict.js [strict mode] (previously Passed)
test/language/expressions/assignment/id-eval-strict.js [strict mode] (previously Passed)
test/language/expressions/assignment/dstr/obj-id-simple-strict.js [strict mode] (previously Passed)
test/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-eval.js [strict mode] (previously Passed)
test/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-arguments.js [strict mode] (previously Passed)
test/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-arguments.js [strict mode] (previously Passed)
test/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-eval.js [strict mode] (previously Passed)
test/language/expressions/prefix-decrement/arguments.js [strict mode] (previously Passed)
test/language/expressions/prefix-decrement/11.4.5-2-2gs.js [strict mode] (previously Passed)
test/language/expressions/prefix-decrement/eval.js [strict mode] (previously Passed)
test/language/expressions/prefix-increment/arguments.js [strict mode] (previously Passed)
test/language/expressions/prefix-increment/eval.js [strict mode] (previously Passed)
test/language/directive-prologue/14.1-4gs.js [strict mode] (previously Passed)
test/language/directive-prologue/14.1-4gs.js (previously Passed)
test/language/directive-prologue/14.1-5gs.js [strict mode] (previously Passed)
test/language/statements/async-function/early-errors-declaration-arguments-in-formal-parameters.js [strict mode] (previously Passed)
test/language/statements/async-function/early-errors-declaration-eval-in-formal-parameters.js [strict mode] (previously Passed)
test/language/statements/function/param-eval-strict.js [strict mode] (previously Passed)
test/language/statements/function/13.1-1gs.js [strict mode] (previously Passed)
test/language/statements/function/enable-strict-via-body.js (previously Passed)
test/language/statements/function/13.1-4gs.js [strict mode] (previously Passed)
test/language/statements/function/13.0_4-5gs.js [strict mode] (previously Passed)
test/language/statements/function/param-arguments-strict.js [strict mode] (previously Passed)
test/language/statements/try/catch-parameter-boundnames-restriction-arguments-negative-early.js [strict mode] (previously Passed)
test/language/statements/try/catch-parameter-boundnames-restriction-eval-negative-early.js [strict mode] (previously Passed)
test/language/arguments-object/10.5-1gs.js [strict mode] (previously Passed)

@Razican Razican added ast Issue surrounding the abstract syntax tree bug Something isn't working lexer Issues surrounding the lexer parser Issues surrounding the parser labels Feb 13, 2022
Copy link
Member

@Razican Razican left a comment

Choose a reason for hiding this comment

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

It's looking pretty good to me, but somehow it's failing a bunch of tests :/

@jedel1043 jedel1043 changed the title arguments and eval should be allowed in the return position in strict functions Allow arguments and eval in the return position of strict functions Feb 13, 2022
@Razican
Copy link
Member

Razican commented Mar 17, 2022

@am-a-man could you check if those failing tests can be fixed? Also, this would need a re-base.

@lupd
Copy link
Contributor

lupd commented Apr 6, 2022

I took at a look at the failing tests. They are failing because they are no longer returning a SyntaxError.

@am-a-man Are you planning on fixing the regressions?

@am-a-man
Copy link
Contributor Author

am-a-man commented Apr 11, 2022

@lupd I'll look into it, although it could take some time, sorry for the delay but it could still take some time due to university exams going on. I'll look into it as soon as I get some time.
Really appreciate the tip on resolving those errors.

@raskad
Copy link
Member

raskad commented Jun 27, 2022

Fixed by #2069

@raskad raskad closed this Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast Issue surrounding the abstract syntax tree bug Something isn't working lexer Issues surrounding the lexer parser Issues surrounding the parser
Projects
None yet
Development

Successfully merging this pull request may close these issues.

arguments and eval should be allowed in the return position in strict functions
4 participants