convert function call to builtInCall in setvariable, and add OOP example

This commit is contained in:
2023-06-21 20:36:06 +01:00
parent ae08f059fb
commit 9fe8bcb515
8 changed files with 59 additions and 56 deletions

View File

@@ -330,5 +330,20 @@ func Map(m anymap) ArObject {
return true, ArErr{}
},
}
obj.obj["object"] = builtinFunc{
"object",
func(args ...any) (any, ArErr) {
if len(args) != 0 {
return nil, ArErr{
TYPE: "TypeError",
message: "expected 0 arguments, got " + fmt.Sprint(len(args)),
EXISTS: true,
}
}
return ArObject{
obj: m,
}, ArErr{}
},
}
return obj
}