optimizations
This commit is contained in:
@@ -173,8 +173,12 @@ func (c *Compiler) Compile(node ast.Node) error {
|
||||
}
|
||||
|
||||
case *ast.IntegerLiteral:
|
||||
integer := object.Integer{Value: node.Value}
|
||||
c.emit(code.OpConstant, c.addConstant(integer))
|
||||
i := object.Integer{Value: node.Value}
|
||||
c.emit(code.OpConstant, c.addConstant(i))
|
||||
|
||||
case *ast.FloatLiteral:
|
||||
f := object.Float{Value: node.Value}
|
||||
c.emit(code.OpConstant, c.addConstant(f))
|
||||
|
||||
case *ast.Null:
|
||||
c.emit(code.OpNull)
|
||||
|
||||
Reference in New Issue
Block a user