visitForIterLoopStmt method

  1. @override
GzBaseNode visitForIterLoopStmt(
  1. ForIterLoopStmt forIterLoopStmt
)
override

Implementation

@override
GzBaseNode visitForIterLoopStmt(ForIterLoopStmt forIterLoopStmt) {
  final vars = forIterLoopStmt.vars.map((e) => e.lexeme).toList(growable: false);
  final exprs = forIterLoopStmt.exprs.map((e) => e.accept(this)).toList(growable: false);
  final body = forIterLoopStmt.body.map((e) => e.accept(this)).toList(growable: false);

  return node(
    'for',
    color: 'yellow',
    shape: 'diamond',
    children: [
      for(final String v in vars)
      node(
        v,
        color: pink,
      ),
      node('in', color: pink, children: exprs),
      node('do', color: 'yellow', children: body),
    ],
  );
}