optimizations
This commit is contained in:
@@ -23,6 +23,9 @@ func Len(ctx context.Context, args ...object.Object) object.Object {
|
||||
case *object.Hash:
|
||||
return object.Integer{Value: int64(obj.Len())}
|
||||
default:
|
||||
if obj == nil {
|
||||
return newError("TypeError: object is nil")
|
||||
}
|
||||
return newError("TypeError: object of type '%s' has no len()", args[0].Type())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user