| 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/dart/ast/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/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 | 8 |
| 9 import 'element_helpers.dart'; | 9 import 'element_helpers.dart'; |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 bool isJsPeerInterface(DartObjectImpl value) => | 67 bool isJsPeerInterface(DartObjectImpl value) => |
| 68 _isBuiltinAnnotation(value, '_js_helper', 'JsPeerInterface'); | 68 _isBuiltinAnnotation(value, '_js_helper', 'JsPeerInterface'); |
| 69 | 69 |
| 70 bool isNativeAnnotation(DartObjectImpl value) => | 70 bool isNativeAnnotation(DartObjectImpl value) => |
| 71 _isBuiltinAnnotation(value, '_js_helper', 'Native'); | 71 _isBuiltinAnnotation(value, '_js_helper', 'Native'); |
| 72 | 72 |
| 73 /// Returns the name value of the `JSExportName` annotation (when compiling | 73 /// Returns the name value of the `JSExportName` annotation (when compiling |
| 74 /// the SDK), or `null` if there's none. This is used to control the name | 74 /// the SDK), or `null` if there's none. This is used to control the name |
| 75 /// under which functions are compiled and exported. | 75 /// under which functions are compiled and exported. |
| 76 String getJSExportName(Element e) { | 76 String getJSExportName(Element e) { |
| 77 var original = e; | 77 if (!e.source.isInSystemLibrary) return null; |
| 78 if (original is PropertyAccessorElement) e = original.variable; | 78 |
| 79 if (e.source.isInSystemLibrary) { | 79 e = e is PropertyAccessorElement && e.isSynthetic ? e.variable : e; |
| 80 var real = original.isSynthetic ? e : original; | 80 return getAnnotationName(e, isJSExportNameAnnotation); |
| 81 return getAnnotationName(real, isJSExportNameAnnotation) ?? e.name; | |
| 82 } | |
| 83 return e.name; | |
| 84 } | 81 } |
| OLD | NEW |