Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix: require-await crash on global await (#12571)
- Loading branch information
1 parent
b8030fc
commit fed20bb
Showing
4 changed files
with
655 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
162 changes: 162 additions & 0 deletions
162
tests/fixtures/parsers/typescript-parsers/global-await.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
"use strict"; | ||
|
||
/** | ||
* Parser: @typescript-eslint/parser v2.6.1 | ||
* Source code: | ||
* await foo(); | ||
*/ | ||
|
||
exports.parse = () => ({ | ||
type: "Program", | ||
body: [ | ||
{ | ||
type: "ExpressionStatement", | ||
expression: { | ||
type: "AwaitExpression", | ||
argument: { | ||
type: "CallExpression", | ||
callee: { | ||
type: "Identifier", | ||
name: "foo", | ||
range: [6, 9], | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 9 | ||
} | ||
} | ||
}, | ||
arguments: [], | ||
optional: false, | ||
range: [6, 11], | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 11 | ||
} | ||
} | ||
}, | ||
range: [0, 11], | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 0 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 11 | ||
} | ||
} | ||
}, | ||
range: [0, 12], | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 0 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 12 | ||
} | ||
} | ||
} | ||
], | ||
sourceType: "module", | ||
range: [0, 12], | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 0 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 12 | ||
} | ||
}, | ||
tokens: [ | ||
{ | ||
type: "Identifier", | ||
value: "await", | ||
range: [0, 5], | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 0 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 5 | ||
} | ||
} | ||
}, | ||
{ | ||
type: "Identifier", | ||
value: "foo", | ||
range: [6, 9], | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 9 | ||
} | ||
} | ||
}, | ||
{ | ||
type: "Punctuator", | ||
value: "(", | ||
range: [9, 10], | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 9 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 10 | ||
} | ||
} | ||
}, | ||
{ | ||
type: "Punctuator", | ||
value: ")", | ||
range: [10, 11], | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 10 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 11 | ||
} | ||
} | ||
}, | ||
{ | ||
type: "Punctuator", | ||
value: ";", | ||
range: [11, 12], | ||
loc: { | ||
start: { | ||
line: 1, | ||
column: 11 | ||
}, | ||
end: { | ||
line: 1, | ||
column: 12 | ||
} | ||
} | ||
} | ||
], | ||
comments: [] | ||
}); |
Oops, something went wrong.