OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart._js_mirrors; | 5 library dart._js_mirrors; |
6 | 6 |
7 import 'dart:_js_embedded_names' show | 7 import 'dart:_js_embedded_names' show |
8 JsGetName, | 8 JsGetName, |
9 ALL_CLASSES, | 9 ALL_CLASSES, |
10 LAZIES, | 10 LAZIES, |
(...skipping 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2624 implements FunctionTypeMirror { | 2624 implements FunctionTypeMirror { |
2625 final _typeData; | 2625 final _typeData; |
2626 String _cachedToString; | 2626 String _cachedToString; |
2627 TypeMirror _cachedReturnType; | 2627 TypeMirror _cachedReturnType; |
2628 UnmodifiableListView<ParameterMirror> _cachedParameters; | 2628 UnmodifiableListView<ParameterMirror> _cachedParameters; |
2629 DeclarationMirror owner; | 2629 DeclarationMirror owner; |
2630 | 2630 |
2631 JsFunctionTypeMirror(this._typeData, this.owner); | 2631 JsFunctionTypeMirror(this._typeData, this.owner); |
2632 | 2632 |
2633 bool get _hasReturnType { | 2633 bool get _hasReturnType { |
2634 return JS('bool', '# in #', JS_GET_NAME(JsGetName.FUNCTION_TYPE_RETURN_TYPE_
TAG), _typeData); | 2634 return JS('bool', '# in #', |
| 2635 JS_GET_NAME(JsGetName.FUNCTION_TYPE_RETURN_TYPE_TAG), _typeData); |
2635 } | 2636 } |
| 2637 |
2636 get _returnType { | 2638 get _returnType { |
2637 return JS('', '#[#]', _typeData, JS_GET_NAME(JsGetName.FUNCTION_TYPE_RETURN_
TYPE_TAG)); | 2639 return JS('', '#[#]', _typeData, |
| 2640 JS_GET_NAME(JsGetName.FUNCTION_TYPE_RETURN_TYPE_TAG)); |
2638 } | 2641 } |
2639 | 2642 |
2640 bool get _isVoid { | 2643 bool get _isVoid { |
2641 return JS('bool', '!!#[#]', _typeData, JS_GET_NAME(JsGetName.FUNCTION_TYPE_V
OID_RETURN_TAG)); | 2644 return JS('bool', '!!#[#]', _typeData, |
| 2645 JS_GET_NAME(JsGetName.FUNCTION_TYPE_VOID_RETURN_TAG)); |
2642 } | 2646 } |
2643 | 2647 |
2644 bool get _hasArguments { | 2648 bool get _hasArguments { |
2645 return JS('bool', '# in #', | 2649 return JS('bool', '# in #', |
2646 JS_GET_NAME(JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG), _typ
eData); | 2650 JS_GET_NAME(JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG), |
| 2651 _typeData); |
2647 } | 2652 } |
2648 List get _arguments { | 2653 List get _arguments { |
2649 return JS('JSExtendableArray', '#[#]', | 2654 return JS('JSExtendableArray', '#[#]', |
2650 _typeData, JS_GET_NAME(JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS
_TAG)); | 2655 _typeData, |
| 2656 JS_GET_NAME(JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG)); |
2651 } | 2657 } |
2652 | 2658 |
2653 bool get _hasOptionalArguments { | 2659 bool get _hasOptionalArguments { |
2654 return JS('bool', '# in #', | 2660 return JS('bool', '# in #', |
2655 JS_GET_NAME(JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG), _typ
eData); | 2661 JS_GET_NAME(JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG), |
| 2662 _typeData); |
2656 } | 2663 } |
2657 List get _optionalArguments { | 2664 List get _optionalArguments { |
2658 return JS('JSExtendableArray', '#[#]', | 2665 return JS('JSExtendableArray', '#[#]', |
2659 _typeData, JS_GET_NAME(JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS
_TAG)); | 2666 _typeData, |
| 2667 JS_GET_NAME(JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG)); |
2660 } | 2668 } |
2661 | 2669 |
2662 bool get _hasNamedArguments { | 2670 bool get _hasNamedArguments { |
2663 return JS('bool', '# in #', | 2671 return JS('bool', '# in #', |
2664 JS_GET_NAME(JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG), _typeDa
ta); | 2672 JS_GET_NAME(JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG), |
| 2673 _typeData); |
2665 } | 2674 } |
2666 get _namedArguments { | 2675 get _namedArguments { |
2667 return JS('=Object', '#[#]', | 2676 return JS('=Object', '#[#]', |
2668 _typeData, JS_GET_NAME(JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TA
G)); | 2677 _typeData, |
| 2678 JS_GET_NAME(JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG)); |
2669 } | 2679 } |
2670 | 2680 |
2671 bool get isOriginalDeclaration => true; | 2681 bool get isOriginalDeclaration => true; |
2672 | 2682 |
2673 bool get isAbstract => false; | 2683 bool get isAbstract => false; |
2674 | 2684 |
2675 bool get isEnum => false; | 2685 bool get isEnum => false; |
2676 | 2686 |
2677 TypeMirror get returnType { | 2687 TypeMirror get returnType { |
2678 if (_cachedReturnType != null) return _cachedReturnType; | 2688 if (_cachedReturnType != null) return _cachedReturnType; |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3036 // have a part (following a '.') that starts with '_'. | 3046 // have a part (following a '.') that starts with '_'. |
3037 const int UNDERSCORE = 0x5f; | 3047 const int UNDERSCORE = 0x5f; |
3038 if (name.isEmpty) return true; | 3048 if (name.isEmpty) return true; |
3039 int index = -1; | 3049 int index = -1; |
3040 do { | 3050 do { |
3041 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; | 3051 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; |
3042 index = name.indexOf('.', index + 1); | 3052 index = name.indexOf('.', index + 1); |
3043 } while (index >= 0 && index + 1 < name.length); | 3053 } while (index >= 0 && index + 1 < name.length); |
3044 return true; | 3054 return true; |
3045 } | 3055 } |
OLD | NEW |