MCPcopy Create free account
hub / github.com/Meridian59/Meridian59 / OutputBaseExpression

Function OutputBaseExpression

blakcomp/codeutil.c:140–176  ·  view source on GitHub ↗

/ * OutputBaseExpression: Given a base expression, first write out 1 byte * for its type, and then 4 bytes for its value */

Source from the content-addressed store, hash-verified

138 * for its type, and then 4 bytes for its value
139 */
140void 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

Callers 1

codegen_callFunction · 0.85

Calls 4

OutputByteFunction · 0.85
codegen_errorFunction · 0.85
OutputIntFunction · 0.85
OutputConstantFunction · 0.85

Tested by

no test coverage detected