add % modulo operator to El lexer, parser, codegen
Lexer and parser already had Percent token and precedence on the compiler/string-interp branch. This commit adds the missing is_int_expr case for Percent so that modulo expressions over Int operands are correctly typed as Int (enabling arithmetic dispatch rather than falling through to string concat or untyped paths). binop_to_c already mapped Percent -> % at HEAD; only is_int_expr needed the Percent arm.
This commit is contained in:
@@ -1771,6 +1771,12 @@ fn is_int_expr(expr: Map<String, Any>) -> Bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
if str_eq(op, "Percent") {
|
||||
if is_int_expr(expr["left"]) {
|
||||
if is_int_expr(expr["right"]) { return true }
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user