Skip to content

Commit

Permalink
fix(parser): dedupe some code
Browse files Browse the repository at this point in the history
  • Loading branch information
KFlash committed Jun 8, 2019
1 parent 7f83f6a commit 51fcd14
Show file tree
Hide file tree
Showing 16 changed files with 928 additions and 190 deletions.
58 changes: 25 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meriyah",
"version": "0.2.10",
"version": "0.2.12",
"description": "A 100% compliant, self-hosted javascript parser with high focus on both performance and stability",
"main": "dist/meriyah.umd.js",
"module": "dist/meriyah.esm.js",
Expand Down Expand Up @@ -60,17 +60,17 @@
"post_coverage": "cross-env cat ./coverage/lcov.info | coveralls"
},
"devDependencies": {
"@types/mocha": "^5.2.6",
"@types/node": "^12.0.2",
"coveralls": "^3.0.3",
"@types/mocha": "^5.2.7",
"@types/node": "^12.0.7",
"coveralls": "^3.0.4",
"cross-env": "^5.2.0",
"husky": "^2.3.0",
"husky": "^2.4.0",
"mocha": "^6.1.4",
"nyc": "^14.1.1",
"path": "^0.12.7",
"prettier": "^1.17.1",
"prettier": "^1.18.2",
"rimraf": "^2.6.3",
"rollup": "^1.13.0",
"rollup": "^1.14.4",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^5.0.0",
"rollup-plugin-typescript2": "^0.21.1",
Expand Down
12 changes: 8 additions & 4 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ export const enum BindingOrigin {
export const enum AssignmentKind {
None = 0,
IsAssignable = 1 << 0,
CannotAssign = 1 << 1
CannotAssign = 1 << 1,
Await = 1 << 2,
Yield = 1 << 3,
}

export const enum DestructuringKind {
Expand All @@ -102,7 +104,8 @@ export const enum Flags {
NewLine = 1 << 0,
HasConstructor = 1 << 5,
Octals = 1 << 6,
SimpleParameterList = 1 << 7
SimpleParameterList = 1 << 7,
Yield = 1 << 8,
}

export const enum FunctionStatement {
Expand Down Expand Up @@ -242,7 +245,8 @@ export function validateBindingIdentifier(
parser: ParserState,
context: Context,
type: BindingType,
t: Token
t: Token,
skipEvalArgCheck: 0 | 1
): void {
if ((t & Token.Keyword) !== Token.Keyword) return;

Expand All @@ -255,7 +259,7 @@ export function validateBindingIdentifier(
report(parser, Errors.FutureReservedWordInStrictModeNotId);
}

if ((t & Token.IsEvalOrArguments) === Token.IsEvalOrArguments) {
if (!skipEvalArgCheck && (t & Token.IsEvalOrArguments) === Token.IsEvalOrArguments) {
report(parser, Errors.StrictEvalArguments);
}

Expand Down
Loading

0 comments on commit 51fcd14

Please sign in to comment.