mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
Update pocketpy.h
This commit is contained in:
parent
d25e27df4a
commit
06d486d2a2
@ -91,17 +91,6 @@ void init_builtins(VM* _vm) {
|
|||||||
return VAR(two_args(VAR(lhs/rhs), VAR(lhs%rhs)));
|
return VAR(two_args(VAR(lhs/rhs), VAR(lhs%rhs)));
|
||||||
});
|
});
|
||||||
|
|
||||||
_vm->bind_builtin_func<1>("vars", [](VM* vm, Args& args) {
|
|
||||||
const PyVar& obj = args[0];
|
|
||||||
List ret;
|
|
||||||
if(!obj.is_tagged() && obj->is_attr_valid()){
|
|
||||||
for(StrName name: obj->attr().keys()){
|
|
||||||
ret.push_back(VAR(name.str()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return VAR(ret);
|
|
||||||
});
|
|
||||||
|
|
||||||
_vm->bind_builtin_func<1>("eval", [](VM* vm, Args& args) {
|
_vm->bind_builtin_func<1>("eval", [](VM* vm, Args& args) {
|
||||||
CodeObject_ code = vm->compile(CAST(Str&, args[0]), "<eval>", EVAL_MODE);
|
CodeObject_ code = vm->compile(CAST(Str&, args[0]), "<eval>", EVAL_MODE);
|
||||||
return vm->_exec(code, vm->top_frame()->_module, vm->top_frame()->_locals);
|
return vm->_exec(code, vm->top_frame()->_module, vm->top_frame()->_locals);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user