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'; |