enterDef method

  1. @override
void enterDef(
  1. DefContext ctx
)
override

The default implementation does nothing.

Implementation

@override
void enterDef(DefContext ctx) {
  final type = ctx.idType()!.text;
  final node = TypeNode(ctx.dataType()!);
  final first = node.children.first;
  if (first.ctx is IdTypeContext) {
    final id = first.ctx.text;
    _sb.writeln(
      '/// [$type] defined in Candid: '
      '${ctx.text}\ntypedef $type = ${kPrimitiveTypeDartMap[id] ?? id};',
    );
    return;
  }
  _eachNode(node, type);
}