@@ -235,21 +235,6 @@ void EXPORT_FUN(free)(emit_t *emit) {
235235 m_del_obj (emit_t , emit );
236236}
237237
238- STATIC void emit_native_set_native_type (emit_t * emit , mp_uint_t op , mp_uint_t arg1 , qstr arg2 ) {
239- (void )op ;
240- {
241- int type = mp_native_type_from_qstr (arg2 );
242- if (type < 0 ) {
243- EMIT_NATIVE_VIPER_TYPE_ERROR (emit , "unknown type '%q'" , arg2 );
244- return ;
245- }
246- {
247- assert (arg1 < emit -> local_vtype_alloc );
248- emit -> local_vtype [arg1 ] = type ;
249- }
250- }
251- }
252-
253238STATIC void emit_pre_pop_reg (emit_t * emit , vtype_kind_t * vtype , int reg_dest );
254239STATIC void emit_post_push_reg (emit_t * emit , vtype_kind_t vtype , int reg );
255240STATIC void emit_native_load_fast (emit_t * emit , qstr qst , mp_uint_t local_num );
@@ -283,6 +268,17 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
283268 emit -> local_vtype [i ] = VTYPE_PYOBJ ;
284269 }
285270
271+ // Set viper type for arguments
272+ if (emit -> do_viper_types ) {
273+ for (int i = 0 ; i < emit -> scope -> id_info_len ; ++ i ) {
274+ id_info_t * id = & emit -> scope -> id_info [i ];
275+ if (id -> flags & ID_FLAG_IS_PARAM ) {
276+ assert (id -> local_num < emit -> local_vtype_alloc );
277+ emit -> local_vtype [id -> local_num ] = id -> flags >> ID_FLAG_VIPER_TYPE_POS ;
278+ }
279+ }
280+ }
281+
286282 // local variables begin unbound, and have unknown type
287283 for (mp_uint_t i = num_args ; i < emit -> local_vtype_alloc ; i ++ ) {
288284 emit -> local_vtype [i ] = VTYPE_UNBOUND ;
@@ -2483,7 +2479,6 @@ STATIC void emit_native_end_except_handler(emit_t *emit) {
24832479}
24842480
24852481const emit_method_table_t EXPORT_FUN (method_table ) = {
2486- emit_native_set_native_type ,
24872482 emit_native_start_pass ,
24882483 emit_native_end_pass ,
24892484 emit_native_last_emit_was_return_value ,
0 commit comments