notify method
Implementation
StubbleResult? notify(NotifyMessage msg, StubbleContext context) {
switch (msg.type) {
case notifyAttrResult:
if (_state == 0) {
leftPart = msg.value;
_state++;
} else if (_state == 2) {
rightPart = msg.value;
return StubbleResult(
pop: true,
message: NotifyMessage(
value: checkCondition(),
type: notifyConditionResult,
charCode: msg.charCode,
),
);
} else {
return StubbleResult(
err: StubbleError(
text: 'If block condition malformed',
code: errorIfBlockMalformed));
}
if (msg.charCode != null) {
return StubbleResult(message: ProcessMessage(charCode: msg.charCode!));
}
break;
case notifyConditionResult:
condition = msg.value;
_state++;
if (msg.charCode != null) {
return StubbleResult(message: ProcessMessage(charCode: msg.charCode!));
}
break;
default:
return StubbleResult(
err: StubbleError(
code: errorUnsupportedNotify,
text:
'State "$runtimeType" does not support notifies of type ${msg.type}'));
}
return null;
}