Code cleanup.

This commit is contained in:
2023-04-22 21:08:06 +08:00
parent 2784544884
commit d72afaa75b
5 changed files with 14 additions and 17 deletions

View File

@@ -27,6 +27,16 @@ namespace Cryville.Common.Pdt {
}
return r;
}
/// <summary>
/// Patches an expression with a lefthand variable and a compound operator.
/// </summary>
/// <param name="target">The name of the lefthand variable.</param>
/// <param name="op">The name of the compound operator.</param>
/// <param name="exp">The expression.</param>
public static void PatchCompound(int target, int op, PdtExpression exp) {
exp.Instructions.AddFirst(new PdtInstruction.PushVariable(target));
exp.Instructions.AddLast(new PdtInstruction.Operate(op, 2));
}
}
internal abstract class PdtInstruction {
internal abstract void Execute(PdtEvaluatorBase etor);