Fix VM memory allocation optimizations by reducing what we allocate on the heap
This commit is contained in:
@@ -173,7 +173,7 @@ func (c *Compiler) Compile(node ast.Node) error {
|
||||
}
|
||||
|
||||
case *ast.IntegerLiteral:
|
||||
integer := &object.Integer{Value: node.Value}
|
||||
integer := object.Integer{Value: node.Value}
|
||||
c.emit(code.OpConstant, c.addConstant(integer))
|
||||
|
||||
case *ast.Null:
|
||||
@@ -356,7 +356,7 @@ func (c *Compiler) Compile(node ast.Node) error {
|
||||
c.loadSymbol(symbol)
|
||||
|
||||
case *ast.StringLiteral:
|
||||
str := &object.String{Value: node.Value}
|
||||
str := object.String{Value: node.Value}
|
||||
c.emit(code.OpConstant, c.addConstant(str))
|
||||
|
||||
case *ast.ArrayLiteral:
|
||||
|
||||
Reference in New Issue
Block a user