diff --git a/src/ceval.h b/src/ceval.h index ee884bfb..995bb5c0 100644 --- a/src/ceval.h +++ b/src/ceval.h @@ -141,7 +141,6 @@ __NEXT_STEP:; _0 = vm->builtins->attr().try_get(_name); if(_0 != nullptr) { PUSH(_0); DISPATCH(); } vm->NameError(_name); - DISPATCH(); } DISPATCH(); TARGET(LOAD_GLOBAL) heap._auto_collect(); diff --git a/src/compiler.h b/src/compiler.h index 06a81c51..b528ec5b 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -707,8 +707,8 @@ __SUBSCR_END: // stack size is n+1 Expr_ val = ctx()->s_expr.popx(); val->emit(ctx()); - for(int i=1; iemit(OP_DUP_TOP, BC_NOARG, BC_KEEPLINE); - for(int i=0; iemit(OP_DUP_TOP, BC_NOARG, BC_KEEPLINE); + for(int j=0; js_expr.popx(); if(e->is_starred()) SyntaxError(); bool ok = e->emit_store(ctx()); diff --git a/src/expr.h b/src/expr.h index d779ecf8..c0958549 100644 --- a/src/expr.h +++ b/src/expr.h @@ -28,10 +28,16 @@ struct Expr{ bool is_starred() const { return star_level() > 0; } // for OP_DELETE_XXX - [[nodiscard]] virtual bool emit_del(CodeEmitContext* ctx) { return false; } + [[nodiscard]] virtual bool emit_del(CodeEmitContext* ctx) { + PK_UNUSED(ctx); + return false; + } // for OP_STORE_XXX - [[nodiscard]] virtual bool emit_store(CodeEmitContext* ctx) { return false; } + [[nodiscard]] virtual bool emit_store(CodeEmitContext* ctx) { + PK_UNUSED(ctx); + return false; + } }; struct CodeEmitContext{ diff --git a/src/vm.h b/src/vm.h index d5590d21..e3070bf8 100644 --- a/src/vm.h +++ b/src/vm.h @@ -962,6 +962,7 @@ inline PyObject* VM::format(Str spec, PyObject* obj){ } }catch(...){ ValueError("invalid format specifer"); + UNREACHABLE(); } if(type != 'f' && dot >= 0) ValueError("precision not allowed in the format specifier"); @@ -1307,18 +1308,18 @@ inline PyObject* VM::vectorcall(int ARGC, int KWARGC, bool op_call){ vkwargs = nullptr; } - for(int i=0; ivarnames_inv.try_get(key); if(index < 0){ if(vkwargs == nullptr){ TypeError(fmt(key.escape(), " is an invalid keyword argument for ", co->name, "()")); }else{ Dict& dict = _CAST(Dict&, vkwargs); - dict.set(VAR(key.sv()), kwargs[i+1]); + dict.set(VAR(key.sv()), kwargs[j+1]); } }else{ - buffer[index] = kwargs[i+1]; + buffer[index] = kwargs[j+1]; } } @@ -1332,7 +1333,7 @@ inline PyObject* VM::vectorcall(int ARGC, int KWARGC, bool op_call){ // copy buffer back to stack s_data.reset(args.begin()); - for(int i=0; i