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

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

Issue 1680263002: Support for dart:typed_data (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Address comments, rebase Created 4 years, 10 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
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/codegen/module_builder.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 73a03deb1bfa25b7b1fbf553bb59bcf754d12aa4..54fc8fccb35aaa5f30985d2637ceb3c38d5cb302 100644
--- a/lib/src/codegen/js_interop.dart
+++ b/lib/src/codegen/js_interop.dart
@@ -35,14 +35,25 @@ bool isJsSpreadInvocation(MethodInvocation i) =>
bool isJSAnnotation(DartObjectImpl value) =>
_isJsLibType('JS', value.type.element);
-/// Whether [value] is a `@JSExportName` (internal annotation used in SDK
-/// instead of `@JS` from `package:js`).
-bool isJSExportNameAnnotation(DartObjectImpl value) {
+bool _isBuiltinAnnotation(
+ DartObjectImpl value, String libraryName, String annotationName) {
var e = value?.type?.element;
- if (e?.name != 'JSExportName') return false;
+ if (e?.name != annotationName) return false;
var uri = e.source.uri;
- return uri.scheme == 'dart' && uri.path == '_foreign_helper';
+ var path = uri.pathSegments[0];
+ return uri.scheme == 'dart' && path == libraryName;
}
+/// Whether [value] is a `@JSExportName` (internal annotation used in SDK
+/// instead of `@JS` from `package:js`).
+bool isJSExportNameAnnotation(DartObjectImpl value) =>
+ _isBuiltinAnnotation(value, '_foreign_helper', 'JSExportName');
+
+bool isJsName(DartObjectImpl value) =>
+ _isBuiltinAnnotation(value, '_js_helper', 'JSName');
+
bool isJsPeerInterface(DartObjectImpl value) =>
- value.type.name == 'JsPeerInterface';
+ _isBuiltinAnnotation(value, '_js_helper', 'JsPeerInterface');
+
+bool isNativeAnnotation(DartObjectImpl value) =>
+ _isBuiltinAnnotation(value, '_js_helper', 'Native');
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/codegen/module_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698