init method Null safety
- int registerBase,
- {required OpInitFunction f,
- required ProgramOperation? shift,
- required bool argDot,
- required ProgramOperation? arg,
- required bool userMode}
override
Implementation
@override
void init(int registerBase,
{required OpInitFunction f,
required ProgramOperation? shift,
required bool argDot,
required ProgramOperation? arg,
required bool userMode}) {
if (arg != null) {
// Move arg over to shift, e.g. for STO + 7
assert(shift == null);
shift = arg;
arg = null;
}
_next = List.generate(min(max + 1, registerBase), (i) {
final a = argDoneFactory((m) => calc(m, i)); // Function currying, baby
a.init(registerBase,
f: f,
shift: shift,
argDot: argDot,
arg: Arg.kDigits[i],
userMode: userMode);
return a;
}, growable: false);
if (max < registerBase) {
_nextOnDot = null;
} else {
assert(!argDot, 'max: $max');
final ka = _nextOnDot = KeyArg(
key: Arg.kDot,
child: DigitArg(
max: max - registerBase,
calc: (m, i) => calc(m, i + registerBase),
argDoneFactory: argDoneFactory));
// Skip over ka, straight to its child:
ka.child.init(registerBase,
f: f, shift: shift, argDot: true, arg: arg, userMode: userMode);
// argName: '.', userMode: userMode));
}
}