mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
...
This commit is contained in:
parent
a484879b14
commit
d0453ab15f
13
src/ceval.h
13
src/ceval.h
@ -470,7 +470,8 @@ __NEXT_STEP:;
|
||||
PUSH(_0);
|
||||
DISPATCH();
|
||||
TARGET(CALL_TP)
|
||||
// [callable, <self>, args: tuple, kwargs: dict]
|
||||
// [callable, <self>, args: tuple, kwargs: dict | NULL]
|
||||
if(byte.arg){
|
||||
_2 = POPX();
|
||||
_1 = POPX();
|
||||
for(PyObject* obj: _CAST(Tuple&, _1)) PUSH(obj);
|
||||
@ -483,6 +484,16 @@ __NEXT_STEP:;
|
||||
_CAST(Dict&, _2).size(), // KWARGC
|
||||
true
|
||||
);
|
||||
}else{
|
||||
// no **kwargs
|
||||
_1 = POPX();
|
||||
for(PyObject* obj: _CAST(Tuple&, _1)) PUSH(obj);
|
||||
_0 = vectorcall(
|
||||
_CAST(Tuple&, _1).size(), // ARGC
|
||||
0, // KWARGC
|
||||
true
|
||||
);
|
||||
}
|
||||
if(_0 == PY_OP_CALL) DISPATCH_OP_CALL();
|
||||
PUSH(_0);
|
||||
DISPATCH();
|
||||
|
@ -686,6 +686,7 @@ struct CallExpr: Expr{
|
||||
for(auto& item: args) item->emit(ctx);
|
||||
ctx->emit(OP_BUILD_TUPLE_UNPACK, (int)args.size(), line);
|
||||
|
||||
if(!kwargs.empty()){
|
||||
for(auto& item: kwargs){
|
||||
if(item.second->is_starred()){
|
||||
if(item.second->star_level() != 2) FATAL_ERROR();
|
||||
@ -699,7 +700,10 @@ struct CallExpr: Expr{
|
||||
}
|
||||
}
|
||||
ctx->emit(OP_BUILD_DICT_UNPACK, (int)kwargs.size(), line);
|
||||
ctx->emit(OP_CALL_TP, BC_NOARG, line);
|
||||
ctx->emit(OP_CALL_TP, 1, line);
|
||||
}else{
|
||||
ctx->emit(OP_CALL_TP, 0, line);
|
||||
}
|
||||
}else{
|
||||
// vectorcall protocal
|
||||
for(auto& item: args) item->emit(ctx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user