latentBridgeLookup property
Propagates every bridge registered in this environment's type lookup
to target for native-object resolution.
Use case: stdlib modules (dart:math, dart:io, …) live in isolated
per-stdlib environments to avoid lexical name collisions, but their
native types (e.g. _Random) must still be discoverable from
globalEnvironment.toBridgedInstance when a script passes a native
instance through an interpreted function. Calling
stdlibEnv.propagateBridgeTypesTo(globalEnvironment) after
registration mirrors the type→bridge mapping without leaking the
lexical name Random into globalEnvironment.
Mirror of tom_d4rt Environment.propagateBridgeTypesTo.
The bridges of the stdlib libraries the script did NOT import, asked for
a native value's type when every other pass misses (SCF44).
Imports govern which NAMES a script can write, not which members a value
it already holds exposes: stdout.encoding is a Utf8Codec whatever the
script imported. propagateBridgeTypesTo copies a module's type→bridge
mappings here only when the module is imported, so without this a value
whose bridge lives in an unimported library had no members at all. Set on
the global environment by the module loader; the nearest one in the chain
answers. Names are untouched — Utf8Codec stays unresolvable as a name.
structural asks for SCC49's suffix rule instead of a precise match; the
caller asks it only after the imported scope's own suffix rule missed.
Implementation
BridgedClass? Function(Type nativeType, {bool structural})?
latentBridgeLookup;