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:
Jeff Epler
2025-08-30 10:51:53 -05:00
committed by Jeff Epler
parent 1d90577b7e
commit 9728538c3a

View File

@@ -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;
}