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

Unified Diff: pkg/compiler/lib/src/native/enqueue.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
« no previous file with comments | « pkg/compiler/lib/src/library_loader.dart ('k') | pkg/compiler/lib/src/native/native.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/native/enqueue.dart
diff --git a/pkg/compiler/lib/src/native/enqueue.dart b/pkg/compiler/lib/src/native/enqueue.dart
index 42ceba2d4b2f9f80c23f757dba1a6a137730675d..e9c3dd688f69aaab8c4f26fcefd72be7809cfd8f 100644
--- a/pkg/compiler/lib/src/native/enqueue.dart
+++ b/pkg/compiler/lib/src/native/enqueue.dart
@@ -120,7 +120,7 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
void processNativeClassesInLibrary(LibraryElement library) {
// Use implementation to ensure the inclusion of injected members.
library.implementation.forEachLocalMember((Element element) {
- if (element.isClass && element.isNative) {
+ if (element.isClass && backend.isNative(element)) {
processNativeClass(element);
}
});
@@ -162,7 +162,7 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
// fact a subclass of a native class.
ClassElement nativeSuperclassOf(ClassElement classElement) {
- if (classElement.isNative) return classElement;
+ if (backend.isNative(classElement)) return classElement;
if (classElement.superclass == null) return null;
return nativeSuperclassOf(classElement.superclass);
}
@@ -173,7 +173,7 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
ClassElement nativeSuperclass = nativeSuperclassOf(element);
if (nativeSuperclass != null) {
nativeClassesAndSubclasses.add(element);
- if (!element.isNative) {
+ if (!backend.isNative(element)) {
nonNativeSubclasses.putIfAbsent(nativeSuperclass,
() => new Set<ClassElement>())
.add(element);
@@ -350,12 +350,12 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
reporter.withCurrentElement(element, () {
if (element.isFunction || element.isGetter || element.isSetter) {
handleMethodAnnotations(element);
- if (element.isNative) {
+ if (backend.isNative(element)) {
registerMethodUsed(element);
}
} else if (element.isField) {
handleFieldAnnotations(element);
- if (element.isNative) {
+ if (backend.isNative(element)) {
registerFieldLoad(element);
registerFieldStore(element);
}
@@ -364,7 +364,7 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
}
handleFieldAnnotations(Element element) {
- if (element.enclosingElement.isNative) {
+ if (backend.isNative(element.enclosingElement)) {
// Exclude non-instance (static) fields - they not really native and are
// compiled as isolate globals. Access of a property of a constructor
// function or a non-method property in the prototype chain, must be coded
@@ -387,10 +387,10 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
/// Sets the native name of [element], either from an annotation, or
/// defaulting to the Dart name.
- void setNativeName(ElementX element) {
+ void setNativeName(MemberElement element) {
String name = findJsNameFromAnnotation(element);
if (name == null) name = element.name;
- element.setNative(name);
+ backend.setNativeMemberName(element, name);
}
/// Sets the native name of the static native method [element], using the
@@ -401,26 +401,27 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
/// use the declared @JSName as the expression
/// 3. If [element] does not have a @JSName annotation, qualify the name of
/// the method with the @Native name of the enclosing class.
- void setNativeNameForStaticMethod(ElementX element) {
+ void setNativeNameForStaticMethod(MethodElement element) {
String name = findJsNameFromAnnotation(element);
if (name == null) name = element.name;
if (isIdentifier(name)) {
- List<String> nativeNames = nativeTagsOfClassRaw(element.enclosingClass);
+ List<String> nativeNames =
+ backend.getNativeTagsOfClassRaw(element.enclosingClass);
if (nativeNames.length != 1) {
reporter.internalError(element,
'Unable to determine a native name for the enclosing class, '
'options: $nativeNames');
}
- element.setNative('${nativeNames[0]}.$name');
+ backend.setNativeMemberName(element, '${nativeNames[0]}.$name');
} else {
- element.setNative(name);
+ backend.setNativeMemberName(element, name);
}
}
bool isIdentifier(String s) => _identifier.hasMatch(s);
bool isNativeMethod(FunctionElementX element) {
- if (!element.library.canUseNative) return false;
+ if (!backend.canLibraryUseNative(element.library)) return false;
// Native method?
return reporter.withCurrentElement(element, () {
Node node = element.parseNode(resolution.parsing);
@@ -545,10 +546,10 @@ class NativeResolutionEnqueuer extends NativeEnqueuerBase {
super.processNativeClass(classElement);
// Js Interop interfaces do not have tags.
- if (classElement.isJsInterop) return;
+ if (backend.isJsInterop(classElement)) return;
// Since we map from dispatch tags to classes, a dispatch tag must be used
// on only one native class.
- for (String tag in nativeTagsOfClass(classElement)) {
+ for (String tag in backend.getNativeTagsOfClass(classElement)) {
ClassElement owner = tagOwner[tag];
if (owner != null) {
if (owner != classElement) {
@@ -648,7 +649,7 @@ class NativeCodegenEnqueuer extends NativeEnqueuerBase {
}
void addSubtypes(ClassElement cls, NativeEmitter emitter) {
- if (!cls.isNative) return;
+ if (!backend.isNative(cls)) return;
if (doneAddSubtypes.contains(cls)) return;
doneAddSubtypes.add(cls);
@@ -668,7 +669,7 @@ class NativeCodegenEnqueuer extends NativeEnqueuerBase {
// natives classes.
ClassElement superclass = cls.superclass;
while (superclass != null && superclass.isMixinApplication) {
- assert(!superclass.isNative);
+ assert(!backend.isNative(superclass));
superclass = superclass.superclass;
}
« no previous file with comments | « pkg/compiler/lib/src/library_loader.dart ('k') | pkg/compiler/lib/src/native/native.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698