Skip to content

Commit 3da677e

Browse files
committed
py: Implement Ellipsis object in native emitter.
1 parent 92ab95f commit 3da677e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

py/emitnative.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,15 +1114,19 @@ STATIC void emit_native_load_const_tok(emit_t *emit, mp_token_kind_t tok) {
11141114
case MP_TOKEN_KW_NONE: vtype = VTYPE_PTR_NONE; val = 0; break;
11151115
case MP_TOKEN_KW_FALSE: vtype = VTYPE_BOOL; val = 0; break;
11161116
case MP_TOKEN_KW_TRUE: vtype = VTYPE_BOOL; val = 1; break;
1117-
default: assert(0); vtype = 0; val = 0; // shouldn't happen
1117+
no_other_choice1:
1118+
case MP_TOKEN_ELLIPSIS: vtype = VTYPE_PYOBJ; val = (mp_uint_t)&mp_const_ellipsis_obj; break;
1119+
default: assert(0); goto no_other_choice1; // to help flow control analysis
11181120
}
11191121
} else {
11201122
vtype = VTYPE_PYOBJ;
11211123
switch (tok) {
11221124
case MP_TOKEN_KW_NONE: val = (mp_uint_t)mp_const_none; break;
11231125
case MP_TOKEN_KW_FALSE: val = (mp_uint_t)mp_const_false; break;
11241126
case MP_TOKEN_KW_TRUE: val = (mp_uint_t)mp_const_true; break;
1125-
default: assert(0); vtype = 0; val = 0; // shouldn't happen
1127+
no_other_choice2:
1128+
case MP_TOKEN_ELLIPSIS: val = (mp_uint_t)&mp_const_ellipsis_obj; break;
1129+
default: assert(0); goto no_other_choice2; // to help flow control analysis
11261130
}
11271131
}
11281132
emit_post_push_imm(emit, vtype, val);

0 commit comments

Comments
 (0)