Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: pkg/compiler/lib/src/js_backend/namer.dart

Issue 2884233002: Use entities in runtime_types (Closed)
Patch Set: Updated cf. comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/js_backend/namer.dart
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index 92f5b1427a05b0d5b92cd87cb667b2daf681be4c..43bb6804b3e4934847540521360696d2f0f7791e 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -30,6 +30,7 @@ import '../world.dart' show ClosedWorld;
import 'backend.dart';
import 'constant_system_javascript.dart';
import 'native_data.dart';
+import 'runtime_types.dart';
part 'field_naming_mixin.dart';
part 'frequency_namer.dart';
@@ -751,7 +752,7 @@ class Namer {
// The name is still not guaranteed to be unique, since both the library
// name and originalName could contain $ symbols and as the library
// name itself might clash.
- String libraryName = _proposeNameForGlobal(library);
+ String libraryName = _proposeNameForLibrary(library);
return "_$libraryName\$$text";
}
}
@@ -1269,7 +1270,8 @@ class Namer {
return element.name.replaceAll('+', '_');
}
if (element.isLibrary) {
- return _proposeNameForLibrary(element);
+ LibraryElement library = element;
+ return _proposeNameForLibrary(library);
}
return element.name;
}
@@ -1280,7 +1282,7 @@ class Namer {
*/
// TODO(sra): Pre-process libraries to assign [libraryLongNames] in a way that
// is independent of the order of calls to namer.
- String _proposeNameForLibrary(LibraryElement library) {
+ String _proposeNameForLibrary(LibraryEntity library) {
String name = libraryLongNames[library];
if (name != null) return name;
// Use the 'file' name, e.g. "package:expect/expect.dart" -> "expect"
@@ -1514,17 +1516,18 @@ class Namer {
assert(Elements.isStaticOrTopLevelFunction(element));
String enclosing =
element.enclosingClass == null ? "" : element.enclosingClass.name;
- String library = _proposeNameForGlobal(element.library);
+ String library = _proposeNameForLibrary(element.library);
return _disambiguateInternalGlobal(
"${library}_${enclosing}_${element.name}\$closure");
}
// This name is used as part of the name of a TypeConstant
- String uniqueNameForTypeConstantElement(Element element) {
+ String uniqueNameForTypeConstantElement(
+ LibraryEntity library, Entity element) {
// TODO(sra): If we replace the period with an identifier character,
// TypeConstants will have better names in unminified code.
- String library = _proposeNameForGlobal(element.library);
- return "${library}.${element.name}";
+ String libraryName = _proposeNameForLibrary(library);
+ return "${libraryName}.${element.name}";
}
String globalObjectForConstant(ConstantValue constant) => 'C';
« no previous file with comments | « pkg/compiler/lib/src/js_backend/impact_transformer.dart ('k') | pkg/compiler/lib/src/js_backend/resolution_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698