| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library dev_compiler.src.js_interop; | 5 library dev_compiler.src.js_interop; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/constant.dart'; | 9 import 'package:analyzer/src/generated/constant.dart'; |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 /// instead of `@JS` from `package:js`). | 41 /// instead of `@JS` from `package:js`). |
| 42 bool isJSExportNameAnnotation(DartObjectImpl value) { | 42 bool isJSExportNameAnnotation(DartObjectImpl value) { |
| 43 var e = value?.type?.element; | 43 var e = value?.type?.element; |
| 44 if (e?.name != 'JSExportName') return false; | 44 if (e?.name != 'JSExportName') return false; |
| 45 var uri = e.source.uri; | 45 var uri = e.source.uri; |
| 46 return uri.scheme == 'dart' && uri.path == '_foreign_helper'; | 46 return uri.scheme == 'dart' && uri.path == '_foreign_helper'; |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool isJsPeerInterface(DartObjectImpl value) => | 49 bool isJsPeerInterface(DartObjectImpl value) => |
| 50 value.type.name == 'JsPeerInterface'; | 50 value.type.name == 'JsPeerInterface'; |
| 51 |
| 52 /// Whether this invocation represents a `genericTypeConstructor` intrinsic |
| 53 /// call, meant to be used only inside `JS` templates. |
| 54 /// |
| 55 /// That intrinsic function is only to be used in JS expressions inside the SDK. |
| 56 /// For instance `JS('', '#(type)', genericTypeConstructor(List))` will |
| 57 /// generate `core.List$(type)`. |
| 58 bool isGenericTypeConstructorIntrinsic(MethodInvocation i) => |
| 59 _isJsLibType('genericTypeConstructor', i.methodName?.bestElement) && |
| 60 i.argumentList.arguments.length == 1; |
| OLD | NEW |