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

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

Issue 1724463003: refactor: avoid parts (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: 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/js_typeref_codegen.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 54fc8fccb35aaa5f30985d2637ceb3c38d5cb302..c953f7b0975cfb7865e1b965c84e6ad7ad2d8adc 100644
--- a/lib/src/codegen/js_interop.dart
+++ b/lib/src/codegen/js_interop.dart
@@ -3,8 +3,11 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/generated/ast.dart';
-import 'package:analyzer/src/generated/element.dart';
import 'package:analyzer/src/generated/constant.dart';
+import 'package:analyzer/src/generated/element.dart';
+import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
+
+import '../utils.dart';
bool _isJsLibType(String expectedName, Element e) =>
e?.name == expectedName && _isJsLib(e.library);
@@ -57,3 +60,14 @@ bool isJsPeerInterface(DartObjectImpl value) =>
bool isNativeAnnotation(DartObjectImpl value) =>
_isBuiltinAnnotation(value, '_js_helper', 'Native');
+
+/// 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;
+ }
+ var jsName = findAnnotation(e, isJSExportNameAnnotation);
+ return getConstantField(jsName, 'name', types.stringType)?.toStringValue();
+}
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/codegen/js_typeref_codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698