defineBridgeClass method

  1. @override
void defineBridgeClass(
  1. BridgeClassDef classDef
)
override

Implementation

@override
void defineBridgeClass(BridgeClassDef classDef) {
  if (!classDef.bridge && !classDef.wrap) {
    throw CompileError(
        'Cannot define a bridge class that\'s not either bridge or wrap');
  }
  final type = classDef.type;
  final spec = type.type.spec;

  if (spec == null) {
    throw CompileError(
        'Cannot define a bridge class that\'s already resolved, a ref, or a generic function type');
  }

  final libraryDeclarations = _bridgeDeclarations[spec.library];
  if (libraryDeclarations == null) {
    _bridgeDeclarations[spec.library] = [classDef];
  } else {
    libraryDeclarations.add(classDef);
  }
}