Commit c31b03ca authored by Guillaume Charifi's avatar Guillaume Charifi

compiler/parser: Remove new from the precedence array.

It has no child, so it cannot be processed by fix_op_precedence().
parent 40626e47
......@@ -1109,7 +1109,6 @@ static const struct op_props *get_op_props(enum bm_ast_node_type type)
/* Left operators. */
[BM_AST_NODE_OP_CAST] = { OP_POS_LEFT, -2, 0 },
[BM_AST_NODE_OP_NEW] = { OP_POS_LEFT, -2, 0 },
[BM_AST_NODE_PREOP_BITWISE_NOT] = { OP_POS_LEFT, -2, 0 },
[BM_AST_NODE_PREOP_DEC] = { OP_POS_LEFT, -2, 0 },
[BM_AST_NODE_PREOP_INC] = { OP_POS_LEFT, -2, 0 },
......@@ -1174,9 +1173,11 @@ static int fix_op_precedence(struct bm_ast_node *op)
do
{
unsigned long children_count = parser_node_get_children_count(op);
fixed = 0;
for (unsigned long i = 0; i < parser_node_get_children_count(op) && i < ARRAY_SIZE(sub_op); i++)
for (unsigned long i = 0; i < children_count && i < ARRAY_SIZE(sub_op); i++)
{
sub_op[i] = parser_node_get_child(op, i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment