len
builtin supports map and module map
This commit is contained in:
parent
d4757efc68
commit
cb5cbad3ad
1 changed files with 4 additions and 0 deletions
|
@ -14,6 +14,10 @@ func builtinLen(args ...Object) (Object, error) {
|
|||
return &Int{Value: int64(len(arg.Value))}, nil
|
||||
case *String:
|
||||
return &Int{Value: int64(len(arg.Value))}, nil
|
||||
case *Map:
|
||||
return &Int{Value: int64(len(arg.Value))}, nil
|
||||
case *ModuleMap:
|
||||
return &Int{Value: int64(len(arg.Value))}, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported type for 'len' function: %s", arg.TypeName())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue