@@ -2141,17 +2141,30 @@ int compile_expr(struct compiler* compiler, Node* expr){
2141
2141
2142
2142
add_instruction (compiler, compiler->instructions ,LOAD_ATTR, idx, GET_ANNO_N (names->at (i)));
2143
2143
2144
+
2145
+ object* stargs=new_tuple ();
2146
+ object* stkwargs=new_tuple ();
2144
2147
object* kwargs=new_tuple ();
2145
2148
2149
+ int i_=0 ;
2150
+ size_t argsize=CALL (expr->node )->args ->size ();
2151
+
2146
2152
// Args (iterate backwards)
2147
- for (auto it = (*DOTCALL (expr->node )->args ).rbegin (); it != (*DOTCALL (expr->node )->args ).rend (); ++it){
2153
+ for (auto it = (*CALL (expr->node )->args ).rbegin (); it != (*CALL (expr->node )->args ).rend (); ++it){
2148
2154
int cmpexpr=compile_expr_keep (compiler, *it);
2149
2155
if (cmpexpr==COMPILER_ERROR){
2150
2156
return cmpexpr;
2151
2157
}
2158
+ if (find (CALL (expr->node )->stargs ->begin (), CALL (expr->node )->stargs ->end (), i_)!=CALL (expr->node )->stargs ->end ()){
2159
+ tuple_append_noinc (stargs, new_int_fromint (i_));
2160
+ }
2161
+ if (find (CALL (expr->node )->stkwargs ->begin (), CALL (expr->node )->stkwargs ->end (), i_+argsize-1 )!=CALL (expr->node )->stkwargs ->end ()){
2162
+ tuple_append_noinc (stkwargs, new_int_fromint (i_+argsize-1 ));
2163
+ }
2164
+ i_++;
2152
2165
}
2153
2166
// Kwargs (iterate backwards)
2154
- for (auto it = (*DOTCALL (expr->node )->kwargs ).rbegin (); it != (*DOTCALL (expr->node )->kwargs ).rend (); ++it){
2167
+ for (auto it = (*CALL (expr->node )->kwargs ).rbegin (); it != (*CALL (expr->node )->kwargs ).rend (); ++it){
2155
2168
tuple_append_noinc (kwargs, str_new_fromstr (*IDENTI (ASSIGN ((*it)->node )->name ->node )->name ));
2156
2169
int cmpexpr=compile_expr_keep (compiler, ASSIGN ((*it)->node )->right );
2157
2170
if (cmpexpr==COMPILER_ERROR){
@@ -2174,15 +2187,6 @@ int compile_expr(struct compiler* compiler, Node* expr){
2174
2187
add_instruction (compiler, compiler->instructions ,LOAD_CONST,idx, GET_ANNO_N (expr));
2175
2188
}
2176
2189
2177
- object* stargs=new_tuple ();
2178
- for (int i: *DOTCALL (expr->node )->stargs ){
2179
- tuple_append_noinc (stargs, new_int_fromint (i));
2180
- }
2181
- object* stkwargs=new_tuple ();
2182
- for (int i: *DOTCALL (expr->node )->stkwargs ){
2183
- tuple_append_noinc (stkwargs, new_int_fromint (i));
2184
- }
2185
-
2186
2190
if (CAST_TUPLE (stargs)->size != 0 || CAST_TUPLE (stkwargs)->size != 0 ){
2187
2191
if (!object_find_bool (compiler->consts ,stargs)){
2188
2192
// Create object
@@ -3932,7 +3936,7 @@ int compile_expr(struct compiler* compiler, Node* expr){
3932
3936
3933
3937
case N_ASSERT: {
3934
3938
compile_expr_keep (compiler, ASSERT (expr->node )->expr );
3935
- add_instruction (compiler, compiler->instructions ,POP_JMP_TOS_TRUE, 2 , GET_ANNO_N (expr));
3939
+ add_instruction (compiler, compiler->instructions ,POP_JMP_TOS_TRUE, (compiler-> instructions -> count * 2 )+ 2 , GET_ANNO_N (expr));
3936
3940
add_instruction (compiler, compiler->instructions ,RAISE_ASSERTIONERR, 0 , GET_ANNO_N (expr));
3937
3941
break ;
3938
3942
}
0 commit comments