Fix VM memory allocation optimizations by reducing what we allocate on the heap
This commit is contained in:
@@ -15,9 +15,9 @@ func Ord(args ...object.Object) object.Object {
|
||||
return newError(err.Error())
|
||||
}
|
||||
|
||||
s := args[0].(*object.String)
|
||||
s := args[0].(object.String)
|
||||
if len(s.Value) == 1 {
|
||||
return &object.Integer{Value: int64(s.Value[0])}
|
||||
return object.Integer{Value: int64(s.Value[0])}
|
||||
}
|
||||
return newError(
|
||||
"TypeError: ord() expected a single character `str` got=%s",
|
||||
|
||||
Reference in New Issue
Block a user