Added opcodes to build collection literals
This commit is contained in:
parent
033aac50c2
commit
08f68f09df
|
@ -123,7 +123,11 @@ type
|
||||||
BeginTry,
|
BeginTry,
|
||||||
FinishTry,
|
FinishTry,
|
||||||
Yield,
|
Yield,
|
||||||
Await
|
Await,
|
||||||
|
BuildList,
|
||||||
|
BuildDict,
|
||||||
|
BuildSet,
|
||||||
|
BuildTuple
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,9 @@ proc primary(self: Parser): ASTNode =
|
||||||
of LeftBrace:
|
of LeftBrace:
|
||||||
let tok = self.step()
|
let tok = self.step()
|
||||||
if self.match(RightBrace):
|
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)
|
result = newDictExpr(@[], @[], tok)
|
||||||
else:
|
else:
|
||||||
result = self.expression()
|
result = self.expression()
|
||||||
|
|
Loading…
Reference in New Issue