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

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: 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
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/js/printer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..5ab5494658e1b3ae65b8286242c81d01f3359246 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,18 @@ 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';
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/js/printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698