DGen
- Implemented code emit for variable expressions (fetching their values) ---- Test cases - Updated test case `simple_variables.t` to be able to test the newly implemented `FetchValueInstr` code emit
This commit is contained in:
parent
3afdd5b05d
commit
990f0ed1cc
|
@ -113,7 +113,15 @@ public final class DCodeEmitter : CodeEmitter
|
|||
/* FetchValueVar */
|
||||
else if(cast(FetchValueVar)instruction)
|
||||
{
|
||||
FetchValueVar fetchValueVarInstr = cast(FetchValueVar)instruction;
|
||||
Context context = fetchValueVarInstr.getContext();
|
||||
|
||||
Variable typedEntityVariable = cast(Variable)context.tc.getResolver().resolveBest(context.getContainer(), fetchValueVarInstr.varName); //TODO: Remove `auto`
|
||||
string typedEntityVariableName = context.tc.getResolver().generateName(context.getContainer(), typedEntityVariable);
|
||||
|
||||
string renamedSymbol = SymbolMapper.symbolLookup(context.getContainer(), typedEntityVariableName);
|
||||
|
||||
return renamedSymbol;
|
||||
}
|
||||
/* BinOpInstr */
|
||||
else if(cast(BinOpInstr)instruction)
|
||||
|
|
|
@ -2,7 +2,7 @@ module simple_variables_decls_ass;
|
|||
|
||||
|
||||
int x = 1+2*2/1-6;
|
||||
int y = 2;
|
||||
int y = 2+x;
|
||||
|
||||
discard "TODO: Technically the below should not be allowed as we cannot do it in C - sadly";
|
||||
y = 5+5;
|
||||
|
|
Loading…
Reference in New Issue