Fix VM memory allocation optimizations by reducing what we allocate on the heap
This commit is contained in:
@@ -16,11 +16,11 @@ func ReadFile(args ...object.Object) object.Object {
|
||||
return newError(err.Error())
|
||||
}
|
||||
|
||||
filename := args[0].(*object.String).Value
|
||||
filename := args[0].(object.String).Value
|
||||
data, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
return newError("IOError: error reading from file %s: %s", filename, err)
|
||||
}
|
||||
|
||||
return &object.String{Value: string(data)}
|
||||
return object.String{Value: string(data)}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user