| 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 import 'package:analyzer/src/generated/ast.dart'; | 5 import 'package:analyzer/dart/ast/ast.dart'; |
| 6 import 'package:analyzer/src/generated/constant.dart'; | 6 import 'package:analyzer/src/generated/constant.dart'; |
| 7 import 'package:analyzer/src/generated/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; | 8 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider; |
| 9 | 9 |
| 10 import '../utils.dart'; | 10 import '../utils.dart'; |
| 11 | 11 |
| 12 bool _isJsLibType(String expectedName, Element e) => | 12 bool _isJsLibType(String expectedName, Element e) => |
| 13 e?.name == expectedName && _isJsLib(e.library); | 13 e?.name == expectedName && _isJsLib(e.library); |
| 14 | 14 |
| 15 /// Returns true if [e] represents any library from `package:js` or is the | 15 /// Returns true if [e] represents any library from `package:js` or is the |
| 16 /// internal `dart:_js_helper` library. | 16 /// internal `dart:_js_helper` library. |
| 17 bool _isJsLib(LibraryElement e) { | 17 bool _isJsLib(LibraryElement e) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 /// Returns the name value of the `JSExportName` annotation (when compiling | 64 /// Returns the name value of the `JSExportName` annotation (when compiling |
| 65 /// the SDK), or `null` if there's none. This is used to control the name | 65 /// the SDK), or `null` if there's none. This is used to control the name |
| 66 /// under which functions are compiled and exported. | 66 /// under which functions are compiled and exported. |
| 67 String getJSExportName(Element e, TypeProvider types) { | 67 String getJSExportName(Element e, TypeProvider types) { |
| 68 if (!e.source.isInSystemLibrary) { | 68 if (!e.source.isInSystemLibrary) { |
| 69 return null; | 69 return null; |
| 70 } | 70 } |
| 71 var jsName = findAnnotation(e, isJSExportNameAnnotation); | 71 var jsName = findAnnotation(e, isJSExportNameAnnotation); |
| 72 return getConstantField(jsName, 'name', types.stringType)?.toStringValue(); | 72 return getConstantField(jsName, 'name', types.stringType)?.toStringValue(); |
| 73 } | 73 } |
| OLD | NEW |