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

Unified Diff: lib/src/codegen/js_interop.dart

Issue 1530563003: Generate all runtime files from dart. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Reverted to new .dart files in input_sdk: please compare them against previous patchset Created 5 years 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: lib/src/codegen/js_interop.dart
diff --git a/lib/src/codegen/js_interop.dart b/lib/src/codegen/js_interop.dart
index 1e6dff69bcbaa90cd632c7b5ae37d12a6e94c3ed..08116421c52cd046435b553e0c3c1c6c4a74dff9 100644
--- a/lib/src/codegen/js_interop.dart
+++ b/lib/src/codegen/js_interop.dart
@@ -15,7 +15,8 @@ bool _isJsLib(LibraryElement e) {
var libName = e?.name;
return libName == 'js' ||
libName == 'js.varargs' ||
- libName == 'dart._js_helper';
+ libName == 'dart._js_helper' ||
+ libName == 'dart._foreign_helper';
}
bool isJsRestAnnotation(DartObjectImpl value) =>
@@ -24,8 +25,17 @@ bool isJsRestAnnotation(DartObjectImpl value) =>
bool isJsSpreadInvocation(MethodInvocation i) =>
_isJsLibType('spread', i.methodName?.bestElement);
+bool isGenericTypeConstructorInvocation(MethodInvocation i) =>
+ _isJsLibType('genericTypeConstructor', i.methodName?.bestElement);
+
// TODO(jmesserly): Move JsPeerInterface to package:js (see issue #135).
-bool isJSAnnotation(DartObjectImpl value) => value.type.name == 'JS';
+bool isJSAnnotation(DartObjectImpl value) =>
+ value.type.name == 'JS' || isJsNameAnnotation(value);
+
+bool isJsNameAnnotation(DartObjectImpl value) {
+ var e = value.type.element;
+ return e?.name == 'JsName' && e.library.name == 'dart._foreign_helper';
+}
bool isJsPeerInterface(DartObjectImpl value) =>
value.type.name == 'JsPeerInterface';

Powered by Google App Engine
This is Rietveld 408576698