registerBridgeType method

void registerBridgeType(
  1. BridgedClass bridgedClass
)

Pre-registers a bridge's native-type mapping for runtime type resolution.

Unlike defineBridge, this does NOT add bridgedClass.name to the lexical scope (_bridgedClasses). It only populates _bridgedClassesLookupByType so that toBridgedInstance can wrap native objects returned by bridge methods regardless of whether the script's imports have been processed yet.

In practice D4rtRunner._registerBridgedDefinitions calls defineBridge (which also sets the type entry), so this method is provided as a type-only counterpart for callers that want to avoid name-scope pollution. Mirrors tom_d4rt:Environment.registerBridgeType.

Implementation

void registerBridgeType(BridgedClass bridgedClass) {
  _bridgedClassesLookupByTypeOrNew[bridgedClass.nativeType] = bridgedClass;
  _invalidateResolutionCache();
}