Skip to content

Commit

Permalink
Fix: Fix parsing of async keyword-named object methods (#352) (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
Standard8 authored and ilyavolodin committed Sep 6, 2017
1 parent d9afabd commit 5eb1388
Show file tree
Hide file tree
Showing 3 changed files with 338 additions and 1 deletion.
3 changes: 2 additions & 1 deletion espree.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ acorn.plugins.espree = function(instance) {
this.type === tt.name ||
this.type === tt.num ||
this.type === tt.string ||
this.type === tt.bracketL
this.type === tt.bracketL ||
this.type.keyword
) &&
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,335 @@
module.exports = {
"type": "Program",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"range": [
0,
23
],
"body": [
{
"type": "ExpressionStatement",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"range": [
0,
23
],
"expression": {
"type": "ObjectExpression",
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 21
}
},
"range": [
1,
21
],
"properties": [
{
"type": "Property",
"loc": {
"start": {
"line": 1,
"column": 2
},
"end": {
"line": 1,
"column": 20
}
},
"range": [
2,
20
],
"method": true,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 14
}
},
"range": [
8,
14
],
"name": "delete"
},
"kind": "init",
"value": {
"type": "FunctionExpression",
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 20
}
},
"range": [
14,
20
],
"id": null,
"generator": false,
"expression": false,
"async": true,
"params": [],
"body": {
"type": "BlockStatement",
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 20
}
},
"range": [
17,
20
],
"body": []
}
}
}
]
}
}
],
"sourceType": "module",
"tokens": [
{
"type": "Punctuator",
"value": "(",
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 1
}
},
"range": [
0,
1
]
},
{
"type": "Punctuator",
"value": "{",
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 2
}
},
"range": [
1,
2
]
},
{
"type": "Identifier",
"value": "async",
"loc": {
"start": {
"line": 1,
"column": 2
},
"end": {
"line": 1,
"column": 7
}
},
"range": [
2,
7
]
},
{
"type": "Keyword",
"value": "delete",
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 14
}
},
"range": [
8,
14
]
},
{
"type": "Punctuator",
"value": "(",
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 15
}
},
"range": [
14,
15
]
},
{
"type": "Punctuator",
"value": ")",
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 16
}
},
"range": [
15,
16
]
},
{
"type": "Punctuator",
"value": "{",
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 18
}
},
"range": [
17,
18
]
},
{
"type": "Punctuator",
"value": "}",
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 20
}
},
"range": [
19,
20
]
},
{
"type": "Punctuator",
"value": "}",
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 21
}
},
"range": [
20,
21
]
},
{
"type": "Punctuator",
"value": ")",
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 22
}
},
"range": [
21,
22
]
},
{
"type": "Punctuator",
"value": ";",
"loc": {
"start": {
"line": 1,
"column": 22
},
"end": {
"line": 1,
"column": 23
}
},
"range": [
22,
23
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
({async delete() { }});

0 comments on commit 5eb1388

Please sign in to comment.