CodeEmitter

- Added a new parameter to `transform(Instruction)` (now `transform(Instruction, Object)`. `customRules` is an `Object` to be interpreted by the underlying emitter which can change how certain transformations are done when it is in a certain state

DGen

- Uses new `CodeEmitter` API
This commit is contained in:
Tristan B. Velloza Kildaire 2023-07-22 00:30:32 +02:00
parent 4e8fb0a801
commit 75372ee132
2 changed files with 6 additions and 2 deletions

View File

@ -165,7 +165,11 @@ public abstract class CodeEmitter
* *
* Params: * Params:
* instruction = The Instruction to transform/emit * instruction = The Instruction to transform/emit
* customRules = an `Object` to be interpreted by
* the underlying emitter which can change how certain
* transformations are done when it is in a certain state
*
* Returns: The Instruction emit as a string * Returns: The Instruction emit as a string
*/ */
public abstract string transform(Instruction instruction); public abstract string transform(Instruction instruction, Object customRules = null);
} }

View File

@ -110,7 +110,7 @@ public final class DCodeEmitter : CodeEmitter
} }
public override string transform(const Instruction instruction) public override string transform(const Instruction instruction, Object customRules = null)
{ {
writeln("\n"); writeln("\n");
gprintln("transform(): "~to!(string)(instruction)); gprintln("transform(): "~to!(string)(instruction));