resolve method

void resolve(
  1. GenerationContext ctx
)

Implementation

void resolve(GenerationContext ctx) {
  if (_resolved) throw StateError('message already resolved');
  _resolved = true;

  final reserved = mixin?.findReservedNames() ?? const <String>[];
  final members = messageMemberNames(
      _descriptor, classname, _usedTopLevelNames,
      reserved: reserved);

  _fieldList = <ProtobufField>[];
  for (final names in members.fieldNames) {
    final field = ProtobufField.message(names, this, ctx);
    if (field.descriptor.hasOneofIndex() &&
        !field.descriptor.proto3Optional) {
      _oneofFields[field.descriptor.oneofIndex].add(field);
    }
    _fieldList.add(field);
  }
  _oneofNames = members.oneofNames;

  for (final m in _messageGenerators) {
    m.resolve(ctx);
  }
  for (final x in _extensionGenerators) {
    x.resolve(ctx);
  }
}