Add null literal
Some checks failed
Build / build (push) Successful in 1m30s
Test / build (push) Has been cancelled

This commit is contained in:
Chuck Smith
2024-03-19 16:33:13 -04:00
parent 60d27f09d7
commit 97eeae0c1a
9 changed files with 59 additions and 0 deletions

View File

@@ -155,6 +155,9 @@ func (c *Compiler) Compile(node ast.Node) error {
integer := &object.Integer{Value: node.Value}
c.emit(code.OpConstant, c.addConstant(integer))
case *ast.Null:
c.emit(code.OpNull)
case *ast.Boolean:
if node.Value {
c.emit(code.OpTrue)