Skip to content

Commit

Permalink
[dartdevc] Only generate temporary id for a library when it is needed
Browse files Browse the repository at this point in the history
Cleanup missed in https://dart-review.googlesource.com/c/sdk/+/119460

Change-Id: I34a48c3767938c9930baf4fb4ada5c3f18649de0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119501
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
  • Loading branch information
nshahan authored and commit-bot@chromium.org committed Oct 2, 2019
1 parent f27d4f2 commit 2e99a41
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/dev_compiler/lib/src/compiler/shared_compiler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,14 @@ abstract class SharedCompiler<Library, Class, InterfaceType, FunctionNode> {
/// Returns the canonical name to refer to the Dart library.
@protected
js_ast.Identifier emitLibraryName(Library library) {
// It's either one of the libraries in this module, or it's an import.
var libraryId = js_ast.TemporaryId(jsLibraryName(library));
// Avoid adding the dart:_runtime to _imports when our runtime unit tests
// import it explicitly. It will always be implicitly imported.
if (isSdkInternalRuntime(library)) return runtimeModule;

// It's either one of the libraries in this module, or it's an import.
return _libraries[library] ??
_imports.putIfAbsent(library, () => libraryId);
_imports.putIfAbsent(
library, () => js_ast.TemporaryId(jsLibraryName(library)));
}

/// Emits imports and extension methods into [items].
Expand Down

0 comments on commit 2e99a41

Please sign in to comment.