Added opcodes to build collection literals

This commit is contained in:
nocturn9x 2021-10-31 10:43:45 +01:00
parent 033aac50c2
commit 08f68f09df
2 changed files with 8 additions and 2 deletions

View File

@ -123,7 +123,11 @@ type
BeginTry,
FinishTry,
Yield,
Await
Await,
BuildList,
BuildDict,
BuildSet,
BuildTuple

View File

@ -250,7 +250,9 @@ proc primary(self: Parser): ASTNode =
of LeftBrace:
let tok = self.step()
if self.match(RightBrace):
# This yields an empty dictionary
# This yields an empty dictionary, not an empty set!
# For empty sets, there will be a builtin set() type
# that can be instantiated with no arguments
result = newDictExpr(@[], @[], tok)
else:
result = self.expression()