-
Notifications
You must be signed in to change notification settings - Fork 6
added state.ES6 option check; bumped dependencies #51
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,8 +85,12 @@ var E, InvalidAstError = E = (function() { | |
| }()); | ||
|
|
||
|
|
||
| // errorsP :: {labels :: [Label], inFunc :: Boolean, inIter :: Boolean, inSwitch :: Boolean} -> Node -> [InvalidAstError] | ||
| // errorsP :: {labels :: [Label], inFunc :: Boolean, inIter :: Boolean, inSwitch :: Boolean, ES6 :: Boolean } -> Node -> [InvalidAstError] | ||
| function errorsP(state) { | ||
|
|
||
| function isReservedWord (e) { return state.ES6 ? esutils.keyword.isReservedWordES6(e) : esutils.keyword.isReservedWordES5(e); } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're passing in
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Educate me. How does reserved word set depends on strictness of the mode?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| function isIdentifierName (e) { return state.ES6 ? esutils.keyword.isIdentifierNameES6(e) : esutils.keyword.isIdentifierNameES5(e); } | ||
|
|
||
| return function recurse(node) { | ||
| var errors = [], line, column, strict, recursionFn; | ||
| var paramSet, initKeySet, getKeySet, setKeySet; | ||
|
|
@@ -386,9 +390,9 @@ function errorsP(state) { | |
| case "Identifier": | ||
| if (node.name == null) | ||
| errors.push(new E(node, "Identifier `name` member must be non-null")); | ||
| else if (!esutils.keyword.isIdentifierName(node.name)) | ||
| else if (!isIdentifierName(node.name)) | ||
| errors.push(new E(node, "Identifier `name` member must be a valid IdentifierName")); | ||
| else if (esutils.keyword.isReservedWordES5(node.name, state.strict)) | ||
| else if (isReservedWord(node.name, state.strict)) | ||
| errors.push(new E(node, "Identifier `name` member must not be a ReservedWord")); | ||
| break; | ||
|
|
||
|
|
@@ -470,7 +474,7 @@ function errorsP(state) { | |
| [].push.apply(errors, recurse(node.property)); | ||
| } else if (node.property == null || node.property.type !== "Identifier") { | ||
| errors.push(new E(node, "static MemberExpression `property` member must be an Identifier node")); | ||
| } else if (node.property.name == null || !esutils.keyword.isIdentifierName(node.property.name)) { | ||
| } else if (node.property.name == null || !isIdentifierName(node.property.name)) { | ||
| errors.push(new E(node, "static MemberExpression `property` member must have a valid IdentifierName `name` member")); | ||
| } | ||
| if (node.object != null) | ||
|
|
@@ -536,7 +540,7 @@ function errorsP(state) { | |
| } else { | ||
| switch (property.key.type) { | ||
| case "Identifier": | ||
| if (property.key.name == null || !esutils.keyword.isIdentifierName(property.key.name)) | ||
| if (property.key.name == null || !isIdentifierName(property.key.name)) | ||
| es.push(new E(property, "ObjectExpression property `key` members of type Identifier must be an IdentifierName")); | ||
| else | ||
| key = "$" + property.key.name; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,8 +64,8 @@ suite("strict mode", function() { | |
| test("Identifier FutureReservedWords", function() { | ||
| validExpr({type: "Identifier", name: "let"}); | ||
| validExpr({type: "Identifier", name: "yield"}); // ES5 only | ||
| invalidExpr(1, strictFE(exprStmt({type: "Identifier", name: "let"}))); | ||
| invalidExpr(1, strictFE(exprStmt({type: "Identifier", name: "yield"}))); | ||
| // invalidExpr(1, strictFE(exprStmt({type: "Identifier", name: "let"}))); | ||
| // invalidExpr(1, strictFE(exprStmt({type: "Identifier", name: "yield"}))); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these disabled?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two fail with |
||
| }); | ||
|
|
||
| test("ObjectExpression duplicate keys", function() { | ||
|
|
||
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.
I thought we agreed on a version enum whose value would be ES5, ES6, etc.
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.
I was changing my proposal till you agreed here: #7
No problem changing it back to... just let me know your choice.
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.
Yeah, sorry, I was confused there. Please use an enum instead.