@@ -8323,7 +8323,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
83238323
83248324 @override
83258325 js_ast.Expression visitSymbolConstant (SymbolConstant node) =>
8326- _emitDartSymbol (node.name);
8326+ _emitDartSymbol (node.name, library : node.libraryReference ? .asLibrary );
83278327
83288328 @override
83298329 js_ast.Expression visitMapConstant (MapConstant node) {
@@ -8767,15 +8767,17 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
87678767 /// Emits a Dart Symbol with the given member [symbolName] .
87688768 ///
87698769 /// If the symbol refers to a private name, its library will be set to the
8770- /// [currentLibrary] , so the Symbol is scoped properly.
8771- js_ast.Expression _emitDartSymbol (String symbolName) {
8770+ /// [currentLibrary] by default, so the Symbol is scoped properly. Symbol
8771+ /// constants should pass the symbol's [library] if the referenced symbol was
8772+ /// declared outside the current library.
8773+ js_ast.Expression _emitDartSymbol (String symbolName, {Library ? library}) {
87728774 // TODO(vsm): Handle qualified symbols correctly.
87738775 var last = symbolName.split ('.' ).last;
87748776 var name = js.escapedString (symbolName, "'" );
87758777 js_ast.Expression result;
87768778 if (last.startsWith ('_' )) {
87778779 var nativeSymbolAccessor = _getSymbol (
8778- _emitPrivateNameSymbol (_currentLibrary! , last),
8780+ _emitPrivateNameSymbol (library ?? _currentLibrary! , last),
87798781 );
87808782 result = js.call ('new #.new(#, #)' , [
87818783 _emitConstructorAccess (_privateSymbolType),
0 commit comments