Code cleanup.

This commit is contained in:
2023-02-10 15:50:49 +08:00
parent b437925f92
commit 1b1ed42a1b
7 changed files with 92 additions and 12 deletions

View File

@@ -11,7 +11,7 @@ namespace Cryville.Common.Pdt {
/// <summary>
/// The count of the operands loaded.
/// </summary>
protected int LoadedOperandCount { get { return ParamCount - _loadindex; } }
protected int LoadedOperandCount { get { return _pc - _loadindex; } }
/// <summary>
/// Gets the operand at the specified index.
/// </summary>
@@ -24,20 +24,20 @@ namespace Cryville.Common.Pdt {
int i = index + _loadindex;
return _operands[i];
}
internal int ParamCount { get; private set; }
readonly int _pc;
/// <summary>
/// Creates an instance of the <see cref="PdtOperator" /> class.
/// </summary>
/// <param name="pc">The suggested parameter count.</param>
protected PdtOperator(int pc) {
ParamCount = pc;
_pc = pc;
_operands = new PdtVariableMemory[pc];
}
PdtEvaluatorBase _etor;
bool _rfreq = true;
internal void Begin(PdtEvaluatorBase etor) {
_etor = etor;
_loadindex = ParamCount;
_loadindex = _pc;
}
internal void LoadOperand(PdtVariableMemory mem) {
if (_loadindex == 0) return;
@@ -55,6 +55,9 @@ namespace Cryville.Common.Pdt {
/// <summary>
/// Executes the operator.
/// </summary>
/// <remarks>
/// <para>When overridden, this method reads operands by calling <see cref="GetOperand(int)" />, and writes the result to the frame obtained by calling <see cref="GetReturnFrame(int, int)" />.</para>
/// </remarks>
protected abstract void Execute();
/// <summary>
/// Gets a return frame.