Skip to content

Commit

Permalink
Clean up safe-await-outside-async error
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohnson committed Oct 21, 2017
1 parent 5e28e85 commit 0b6c44a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/plugins/lightscript.js
Expand Up @@ -462,7 +462,9 @@ pp.parseIfExpression = function (node) {
// c/p parseAwait

pp.parseSafeAwait = function (node) {
if (!this.state.inAsync) this.unexpected();
if (!this.state.inAsync) {
this.unexpected(this.state.lastTokStart, "Safe await is illegal outside of an async function.");
}
node.argument = this.parseMaybeUnary();
return this.finishNode(node, "SafeAwaitExpression");
};
Expand Down
@@ -0,0 +1 @@
<!- waitable
@@ -0,0 +1,3 @@
{
"throws": "Safe await is illegal outside of an async function. (1:0)"
}

0 comments on commit 0b6c44a

Please sign in to comment.