Skip to content

Commit

Permalink
Fix: Make obj.await work in modules (fixes #258)
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Mar 14, 2016
1 parent eadc683 commit 5783282
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 3 deletions.
3 changes: 0 additions & 3 deletions espree.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ function isValidNode(node) {
var ecma = extra.ecmaFeatures;

switch (node.type) {
case "Identifier":
return !extra.isModule || node.name !== "await";

case "ExperimentalSpreadProperty":
case "ExperimentalRestProperty":
return ecma.experimentalObjectRestSpread;
Expand Down
165 changes: 165 additions & 0 deletions tests/fixtures/ecma-version/6/modules/valid-await.result.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
module.exports = {
"type": "Program",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 10
}
},
"range": [
0,
10
],
"body": [
{
"type": "ExpressionStatement",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 10
}
},
"range": [
0,
10
],
"expression": {
"type": "MemberExpression",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"range": [
0,
9
],
"object": {
"type": "Identifier",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 3
}
},
"range": [
0,
3
],
"name": "obj"
},
"property": {
"type": "Identifier",
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 9
}
},
"range": [
4,
9
],
"name": "await"
},
"computed": false
}
}
],
"sourceType": "script",
"tokens": [
{
"type": "Identifier",
"value": "obj",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 3
}
},
"range": [
0,
3
]
},
{
"type": "Punctuator",
"value": ".",
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 4
}
},
"range": [
3,
4
]
},
{
"type": "Identifier",
"value": "await",
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 9
}
},
"range": [
4,
9
]
},
{
"type": "Punctuator",
"value": ";",
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
}
},
"range": [
9,
10
]
}
]
};
1 change: 1 addition & 0 deletions tests/fixtures/ecma-version/6/modules/valid-await.src.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj.await;

1 comment on commit 5783282

@xjamundx
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Please sign in to comment.