/ * OutputBaseExpression: Given a base expression, first write out 1 byte * for its type, and then 4 bytes for its value */
| 138 | * for its type, and then 4 bytes for its value |
| 139 | */ |
| 140 | void OutputBaseExpression(FILE *outfile, expr_type expr) |
| 141 | { |
| 142 | id_type id; |
| 143 | |
| 144 | switch(expr->type) |
| 145 | { |
| 146 | case E_IDENTIFIER: |
| 147 | id = expr->value.idval; |
| 148 | switch (id->type) |
| 149 | { |
| 150 | case I_PROPERTY: |
| 151 | OutputByte(outfile, (BYTE) PROPERTY); |
| 152 | break; |
| 153 | |
| 154 | case I_LOCAL: |
| 155 | OutputByte(outfile, (BYTE) LOCAL_VAR); |
| 156 | break; |
| 157 | |
| 158 | case I_CLASSVAR: |
| 159 | OutputByte(outfile, (BYTE) CLASS_VAR); |
| 160 | break; |
| 161 | |
| 162 | default: |
| 163 | codegen_error("Bad variable type on %s in OutputBaseExpression", id->name); |
| 164 | } |
| 165 | OutputInt(outfile, id->idnum); |
| 166 | break; |
| 167 | |
| 168 | case E_CONSTANT: |
| 169 | OutputByte(outfile, (BYTE) CONSTANT); |
| 170 | OutputConstant(outfile, expr->value.constval); |
| 171 | break; |
| 172 | |
| 173 | default: |
| 174 | codegen_error("Bad expression type (%d) in OutputBaseExpression", expr->type); |
| 175 | } |
| 176 | } |
| 177 | /************************************************************************/ |
| 178 | /* |
| 179 | * BackpatchGoto: Go back to the spot "source" in the file, and write out |
no test coverage detected