[parser] Use scope flags to check arguments (#10801)

* chore: add test case

Co-authored-by: Jens Maier<jens@elberet.de>

* use scope flags to check arguments
This commit is contained in:
Huáng Jùnliàng
2019-12-05 02:23:53 -05:00
committed by Nicolò Ribaudo
parent a0bed42aec
commit c6e966cac9
8 changed files with 664 additions and 2 deletions

View File

@@ -2208,7 +2208,11 @@ export default class ExpressionParser extends LValParser {
}
}
if (this.state.inClassProperty && word === "arguments") {
if (
this.scope.inClass &&
!this.scope.inNonArrowFunction &&
word === "arguments"
) {
this.raise(
startLoc,
"'arguments' is not allowed in class field initializer",