also derete this #3

Closed
N00nehere wants to merge 49 commits from (deleted):n00nehere-patch-2 into master
1 changed files with 3 additions and 2 deletions
Showing only changes of commit 6500dd632e - Show all commits

View File

@ -275,7 +275,8 @@ proc primary(self: Parser): ASTNode =
let tok = self.step()
if self.currentFunction == nil:
self.error("'yield' cannot be used outside functions")
elif self.currentFunction.kind == lambdaExpr or not FunDecl(self.currentFunction).isGenerator:
elif self.currentFunction.token.kind != Generator:
# It's easier than doing conversions for lambda/funDecl
self.error("'yield' cannot be used outside generators")
if not self.check([RightBrace, RightBracket, RightParen, Comma, Semicolon]):
# Expression delimiters
@ -287,7 +288,7 @@ proc primary(self: Parser): ASTNode =
let tok = self.step()
if self.currentFunction == nil:
self.error("'await' cannot be used outside functions")
if self.currentFunction.kind == lambdaExpr or not FunDecl(self.currentFunction).isAsync:
if self.currentFunction.token.kind != Coroutine:
self.error("'await' can only be used inside coroutines")
result = newAwaitExpr(self.expression(), tok)
of RightParen, RightBracket, RightBrace: