mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-compiler: rename operator field to op for c++ compatibility
Rename mrb_ast_op_asgn_node.operator field to op to avoid conflict with C++ operator keyword. Update all references including macro definitions and field access code. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4533,7 +4533,7 @@ gen_op_asgn_var(codegen_scope *s, node *varnode, int val)
|
||||
struct mrb_ast_op_asgn_node *op_asgn_n = op_asgn_node(varnode);
|
||||
node *lhs = op_asgn_n->lhs;
|
||||
node *rhs = op_asgn_n->rhs;
|
||||
mrb_sym sym = op_asgn_n->operator;
|
||||
mrb_sym sym = op_asgn_n->op;
|
||||
mrb_int len;
|
||||
const char *name = mrb_sym_name_len(s->mrb, sym, &len);
|
||||
int vsp = -1;
|
||||
|
||||
@@ -337,7 +337,7 @@ struct mrb_ast_masgn_node {
|
||||
struct mrb_ast_op_asgn_node {
|
||||
struct mrb_ast_var_header header; /* 8 bytes */
|
||||
struct mrb_ast_node *lhs; /* Left-hand side (target) */
|
||||
mrb_sym operator; /* Assignment operator (e.g., +=, -=, etc.) */
|
||||
mrb_sym op; /* Assignment operator (e.g., +=, -=, etc.) */
|
||||
struct mrb_ast_node *rhs; /* Right-hand side (value) */
|
||||
};
|
||||
|
||||
@@ -495,7 +495,7 @@ struct mrb_ast_super_node {
|
||||
#define MASGN_NODE_RHS(n) (masgn_node(n)->rhs)
|
||||
|
||||
#define OP_ASGN_NODE_LHS(n) (op_asgn_node(n)->lhs)
|
||||
#define OP_ASGN_NODE_OP(n) (op_asgn_node(n)->operator)
|
||||
#define OP_ASGN_NODE_OP(n) (op_asgn_node(n)->op)
|
||||
#define OP_ASGN_NODE_RHS(n) (op_asgn_node(n)->rhs)
|
||||
|
||||
/* Expression node value access macros */
|
||||
|
||||
@@ -1574,7 +1574,7 @@ new_op_asgn(parser_state *p, node *a, mrb_sym op, node *b)
|
||||
struct mrb_ast_op_asgn_node *n = (struct mrb_ast_op_asgn_node*)parser_alloc_var(p, total_size, class);
|
||||
init_var_header(&n->header, p, NODE_OP_ASGN, class);
|
||||
n->lhs = a;
|
||||
n->operator = op;
|
||||
n->op = op;
|
||||
n->rhs = b;
|
||||
return cons_head((node*)NODE_VARIABLE, (node*)n);
|
||||
}
|
||||
|
||||
@@ -1636,7 +1636,7 @@ new_op_asgn(parser_state *p, node *a, mrb_sym op, node *b)
|
||||
struct mrb_ast_op_asgn_node *n = (struct mrb_ast_op_asgn_node*)parser_alloc_var(p, total_size, class);
|
||||
init_var_header(&n->header, p, NODE_OP_ASGN, class);
|
||||
n->lhs = a;
|
||||
n->operator = op;
|
||||
n->op = op;
|
||||
n->rhs = b;
|
||||
return cons_head((node*)NODE_VARIABLE, (node*)n);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user