| 103 | } |
| 104 | |
| 105 | static AR_ExpNode *_AR_EXP_CloneOperand |
| 106 | ( |
| 107 | const AR_ExpNode *exp |
| 108 | ) { |
| 109 | AR_ExpNode *clone = rm_calloc(1, sizeof(AR_ExpNode)); |
| 110 | clone->type = AR_EXP_OPERAND; |
| 111 | |
| 112 | switch(exp->operand.type) { |
| 113 | case AR_EXP_CONSTANT: |
| 114 | clone->operand.type = AR_EXP_CONSTANT; |
| 115 | clone->operand.constant = SI_ShallowCloneValue(exp->operand.constant); |
| 116 | break; |
| 117 | case AR_EXP_VARIADIC: |
| 118 | clone->operand.type = exp->operand.type; |
| 119 | clone->operand.variadic.entity_alias = exp->operand.variadic.entity_alias; |
| 120 | clone->operand.variadic.entity_alias_idx = exp->operand.variadic.entity_alias_idx; |
| 121 | break; |
| 122 | case AR_EXP_PARAM: |
| 123 | clone->operand.type = AR_EXP_PARAM; |
| 124 | clone->operand.param_name = exp->operand.param_name; |
| 125 | break; |
| 126 | case AR_EXP_BORROW_RECORD: |
| 127 | clone->operand.type = AR_EXP_BORROW_RECORD; |
| 128 | break; |
| 129 | default: |
| 130 | ASSERT(false); |
| 131 | break; |
| 132 | } |
| 133 | |
| 134 | return clone; |
| 135 | } |
| 136 | |
| 137 | static AR_ExpNode *_AR_EXP_NewOpNode(uint child_count) { |
| 138 | AR_ExpNode *node = rm_calloc(1, sizeof(AR_ExpNode)); |
no test coverage detected