Index: lib/src/compiler/js_interop.dart |
diff --git a/lib/src/codegen/js_interop.dart b/lib/src/compiler/js_interop.dart |
similarity index 88% |
rename from lib/src/codegen/js_interop.dart |
rename to lib/src/compiler/js_interop.dart |
index 0c2178a6629a0f6a5d33595138515b1769127b6b..db0b7833bc25dcb31fd7f23350b0a491fb0f2e73 100644 |
--- a/lib/src/codegen/js_interop.dart |
+++ b/lib/src/compiler/js_interop.dart |
@@ -5,9 +5,8 @@ |
import 'package:analyzer/dart/ast/ast.dart'; |
import 'package:analyzer/src/generated/constant.dart'; |
import 'package:analyzer/dart/element/element.dart'; |
-import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; |
-import '../utils.dart'; |
+import 'element_helpers.dart'; |
bool _isJsLibType(String expectedName, Element e) => |
e?.name == expectedName && _isJsLib(e.library); |
@@ -64,10 +63,9 @@ bool isNativeAnnotation(DartObjectImpl value) => |
/// Returns the name value of the `JSExportName` annotation (when compiling |
/// the SDK), or `null` if there's none. This is used to control the name |
/// under which functions are compiled and exported. |
-String getJSExportName(Element e, TypeProvider types) { |
- if (!e.source.isInSystemLibrary) { |
- return null; |
+String getJSExportName(Element e) { |
+ if (e.source.isInSystemLibrary) { |
+ return getAnnotationName(e, isJSExportNameAnnotation) ?? e.name; |
} |
- var jsName = findAnnotation(e, isJSExportNameAnnotation); |
- return getConstantField(jsName, 'name', types.stringType)?.toStringValue(); |
+ return e.name; |
} |