len builtin supports map and module map

This commit is contained in:
Daniel Kang 2019-01-17 16:51:26 -08:00
parent d4757efc68
commit cb5cbad3ad

View file

@ -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())
}