mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
py/compile: Throw SyntaxError instead of asserting.
This condition corresponds to invalid asm code like
```
@micropython.asm_rv32
def l():
a=di(a2, a2, -1)
```
and possibly other forms where nodes[0] is not a STRUCT.
Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
@@ -3277,7 +3277,9 @@ static void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind
|
||||
}
|
||||
|
||||
// check structure of parse node
|
||||
assert(MP_PARSE_NODE_IS_STRUCT(pns2->nodes[0]));
|
||||
if (!MP_PARSE_NODE_IS_STRUCT(pns2->nodes[0])) {
|
||||
goto not_an_instruction;
|
||||
}
|
||||
if (!MP_PARSE_NODE_IS_NULL(pns2->nodes[1])) {
|
||||
goto not_an_instruction;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user