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

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

Issue 13973017: Revert "Revert "Allow multiple tags in native clause."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase 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 93e706b6b67d028731741274e6aeb83cb9754a4c..c64da323dc2d8a76886f6c8619b601be01ed3ad7 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/native_emitter.dart
@@ -99,18 +99,9 @@ class NativeEmitter {
return backend.namer.isolateAccess(element);
}
- bool isNativeGlobal(String quotedName) {
- return identical(quotedName[1], '@');
- }
-
- String toNativeTag(ClassElement cls) {
+ List<String> nativeTagsOfClass(ClassElement cls) {
String quotedName = cls.nativeTagInfo.slowToString();
- 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);
- }
+ return quotedName.substring(1, quotedName.length - 1).split(',');
}
/**
@@ -185,8 +176,8 @@ class NativeEmitter {
// proto chain.
// TODO(9907): Fix DOM generation. We might need an annotation.
if (classElement.isNative()) {
- String nativeTag = toNativeTag(classElement);
- if (nativeTag == 'HTMLElement') {
+ List<String> nativeTags = nativeTagsOfClass(classElement);
+ if (nativeTags.contains('HTMLElement')) {
nonleafClasses.add(classElement);
needed = true;
}
@@ -207,12 +198,12 @@ class NativeEmitter {
new Map<ClassElement, Set<String>>();
for (ClassElement classElement in classes) {
- String nativeTag = toNativeTag(classElement);
+ List<String> nativeTags = nativeTagsOfClass(classElement);
if (nonleafClasses.contains(classElement)) {
nonleafTags
.putIfAbsent(classElement, () => new Set<String>())
- .add(nativeTag);
+ .addAll(nativeTags);
} else {
ClassElement sufficingInterceptor = classElement;
while (!neededClasses.contains(sufficingInterceptor)) {
@@ -223,7 +214,7 @@ class NativeEmitter {
}
leafTags
.putIfAbsent(sufficingInterceptor, () => new Set<String>())
- .add(nativeTag);
+ .addAll(nativeTags);
}
}
@@ -290,7 +281,6 @@ class NativeEmitter {
void generateDefineNativeMethods(
Set<String> tags, ClassElement classElement, String definer) {
if (tags == null) return;
-
String tagsString = (tags.toList()..sort()).join('|');
jsAst.Expression definition =
js(definer)(
@@ -359,7 +349,6 @@ 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