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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart

Issue 14358016: Revert "Allow multiple tags in native clause." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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: sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
index a304a18ae7236cd7467c66789e68a570f706e764..93e706b6b67d028731741274e6aeb83cb9754a4c 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
@@ -99,9 +99,18 @@ class NativeEmitter {
return backend.namer.isolateAccess(element);
}
- List<String> nativeTagsOfClass(ClassElement cls) {
+ bool isNativeGlobal(String quotedName) {
+ return identical(quotedName[1], '@');
+ }
+
+ String toNativeTag(ClassElement cls) {
String quotedName = cls.nativeTagInfo.slowToString();
- return quotedName.substring(1, quotedName.length - 1).split(',');
+ if (isNativeGlobal(quotedName)) {
+ // Global object, just be like the other types for now.
+ return quotedName.substring(3, quotedName.length - 1);
+ } else {
+ return quotedName.substring(2, quotedName.length - 1);
+ }
}
/**
@@ -176,8 +185,8 @@ class NativeEmitter {
// proto chain.
// TODO(9907): Fix DOM generation. We might need an annotation.
if (classElement.isNative()) {
- List<String> nativeTags = nativeTagsOfClass(classElement);
- if (nativeTags.contains('HTMLElement')) {
+ String nativeTag = toNativeTag(classElement);
+ if (nativeTag == 'HTMLElement') {
nonleafClasses.add(classElement);
needed = true;
}
@@ -198,12 +207,12 @@ class NativeEmitter {
new Map<ClassElement, Set<String>>();
for (ClassElement classElement in classes) {
- List<String> nativeTags = nativeTagsOfClass(classElement);
+ String nativeTag = toNativeTag(classElement);
if (nonleafClasses.contains(classElement)) {
nonleafTags
.putIfAbsent(classElement, () => new Set<String>())
- .addAll(nativeTags);
+ .add(nativeTag);
} else {
ClassElement sufficingInterceptor = classElement;
while (!neededClasses.contains(sufficingInterceptor)) {
@@ -214,7 +223,7 @@ class NativeEmitter {
}
leafTags
.putIfAbsent(sufficingInterceptor, () => new Set<String>())
- .addAll(nativeTags);
+ .add(nativeTag);
}
}
@@ -350,6 +359,7 @@ class NativeEmitter {
// foo(null, y).
ClassElement classElement = member.enclosingElement;
+ String nativeTagInfo = classElement.nativeTagInfo.slowToString();
List<jsAst.Statement> statements = <jsAst.Statement>[];
potentiallyConvertDartClosuresToJs(statements, member, stubParameters);

Powered by Google App Engine
This is Rietveld 408576698