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

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

Issue 1408043002: Move native and js interop properties from the element model to the JS backend (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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 783b5181750e069b5d438ec094efa4e723d0f4df..26efc8b2efaab5dc68ca40ba6a6e7ed20e473da9 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -637,8 +637,9 @@ class Namer {
}
String _jsNameHelper(Element e) {
- if (e.jsInteropName != null && e.jsInteropName.isNotEmpty)
- return e.jsInteropName;
+ String jsInteropName = backend.getJsInteropName(e);
+ if (jsInteropName != null && jsInteropName.isNotEmpty)
+ return jsInteropName;
return e.isLibrary ? 'self' : e.name;
}
@@ -649,7 +650,7 @@ class Namer {
/// Map class of the goog.map JavaScript library would have path
/// "goog.maps.Map".
String fixedBackendPath(Element element) {
- if (!element.isJsInterop) return null;
+ if (!backend.isJsInterop(element)) return null;
if (element.isInstanceMember) return 'this';
if (element.isConstructor) return fixedBackendPath(element.enclosingClass);
if (element.isLibrary) return 'self';
@@ -791,8 +792,8 @@ class Namer {
jsAst.Name instanceFieldPropertyName(FieldElement element) {
ClassElement enclosingClass = element.enclosingClass;
- if (element.hasFixedBackendName) {
- return new StringBackedName(element.fixedBackendName);
+ if (backend.hasFixedBackendName(element)) {
+ return new StringBackedName(backend.getFixedBackendName(element));
}
// Instances of BoxFieldElement are special. They are already created with
@@ -832,8 +833,8 @@ class Namer {
/// True if [class_] is a non-native class that inherits from a native class.
bool _isUserClassExtendingNative(ClassElement class_) {
- return !class_.isNative &&
- Elements.isNativeOrExtendsNative(class_.superclass);
+ return !backend.isNative(class_) &&
+ backend.isNativeOrExtendsNative(class_.superclass);
}
/// Annotated name for the setter of [element].
@@ -1216,11 +1217,11 @@ class Namer {
return cls.name;
}
List<String> names = classes
- .where((cls) => !Elements.isNativeOrExtendsNative(cls))
+ .where((cls) => !backend.isNativeOrExtendsNative(cls))
.map(abbreviate)
.toList();
// There is one dispatch mechanism for all native classes.
- if (classes.any((cls) => Elements.isNativeOrExtendsNative(cls))) {
+ if (classes.any((cls) => backend.isNativeOrExtendsNative(cls))) {
names.add("x");
}
// Sort the names of the classes after abbreviating them to ensure
« no previous file with comments | « pkg/compiler/lib/src/js_backend/js_interop_analysis.dart ('k') | pkg/compiler/lib/src/js_backend/patch_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698