prefixSurface method

Environment prefixSurface(
  1. Environment scriptGlobal, {
  2. Set<String>? showNames,
  3. Set<String>? hideNames,
})

The environment an import ... as prefix of this exported environment binds to the prefix: the names the library exports, filtered by showNames / hideNames, and nothing behind them, so a prefixed lookup that misses fails as it does in Dart (pull request #8).

scriptGlobal is the script's global scope. dart:core and dart:async export it, because they are registered where the script inherits them rather than in a library of their own; a prefix on them reaches what that scope inherits, but not the script's own declarations.

Implementation

Environment prefixSurface(
  Environment scriptGlobal, {
  Set<String>? showNames,
  Set<String>? hideNames,
}) {
  if (identical(this, scriptGlobal)) {
    return Environment(enclosing: _enclosing ?? this);
  }
  return shallowCopyFiltered(showNames: showNames, hideNames: hideNames);
}