generateSequenceAction method
void
generateSequenceAction(
- SequenceExpression node,
- CodeBlock block,
- ExpressionGenerator generator, {
- required List<
String?> localVariables, - required List<
String?> semanticVariables, - required List<
String> types,
inherited
Implementation
void generateSequenceAction(
SequenceExpression node, CodeBlock block, ExpressionGenerator generator,
{required List<String?> localVariables,
required List<String?> semanticVariables,
required List<String> types}) {
final expressions = node.expressions;
if (generator.variable != null || node.actionIndex != null) {
final errors = <String>[];
void action(CodeBlock block) {
final actionCodeGenerator = ActionCodeGenerator(
block: block,
actionSource: node.actionSource,
localVariables: localVariables,
resultType: node.resultType,
semanticVariables: semanticVariables,
types: types,
variable: generator.variable,
);
actionCodeGenerator.generate(errors);
if (errors.isNotEmpty) {
final message = 'Error generating result for expression: $node';
throw StateError(message);
}
}
if (expressions.last.isOptional) {
action(block);
generator.success = block;
} else {
final ifElse = IfElseGenerator(ref(Members.ok));
ifElse.ifCode(action);
block.addLazyCode(() => ifElse.generate().code);
//block.if$(ref(Members.ok), (block) {
// action(block);
// generator.success = block;
//});
}
}
}