visitDef method

  1. @override
IDLType<RuleContext> visitDef(
  1. DefContext ctx
)
override

The default implementation returns the result of calling visitChildren on ctx.

Implementation

@override
IDLType<RuleContext> visitDef(DefContext ctx) {
  final id = visit(ctx.idType()!) as IdType;
  final dataTypeContext = ctx.dataType()!;
  final body = visit(dataTypeContext) as DataType;
  final did = id.did;
  final def = Def(ctx, id, body);
  if (dataTypeContext.recordType() == null &&
      dataTypeContext.variantType() == null) {
    typedefs[def.did] = def;
  }
  sers[did] = () => def;
  return def;
}