Chromium Code Reviews| 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_FUNCTION_TYPE_RETURN_TYPE_TAG(), _typeData); | 2634 return JS('bool', '# in #', JS_GET_NAME(JsGetName.FUNCTION_TYPE_RETURN_TYPE_ TAG), _typeData); |
|
herhut
2015/06/03 08:58:28
Long line...
| |
| 2635 } | 2635 } |
| 2636 get _returnType { | 2636 get _returnType { |
| 2637 return JS('', '#[#]', _typeData, JS_FUNCTION_TYPE_RETURN_TYPE_TAG()); | 2637 return JS('', '#[#]', _typeData, JS_GET_NAME(JsGetName.FUNCTION_TYPE_RETURN_ TYPE_TAG)); |
|
herhut
2015/06/03 08:58:28
Long line...
| |
| 2638 } | 2638 } |
| 2639 | 2639 |
| 2640 bool get _isVoid { | 2640 bool get _isVoid { |
| 2641 return JS('bool', '!!#[#]', _typeData, JS_FUNCTION_TYPE_VOID_RETURN_TAG()); | 2641 return JS('bool', '!!#[#]', _typeData, JS_GET_NAME(JsGetName.FUNCTION_TYPE_V OID_RETURN_TAG)); |
|
herhut
2015/06/03 08:58:28
Long line...
| |
| 2642 } | 2642 } |
| 2643 | 2643 |
| 2644 bool get _hasArguments { | 2644 bool get _hasArguments { |
| 2645 return JS('bool', '# in #', | 2645 return JS('bool', '# in #', |
| 2646 JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG(), _typeData); | 2646 JS_GET_NAME(JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG), _typ eData); |
|
herhut
2015/06/03 08:58:28
Long line...
| |
| 2647 } | 2647 } |
| 2648 List get _arguments { | 2648 List get _arguments { |
| 2649 return JS('JSExtendableArray', '#[#]', | 2649 return JS('JSExtendableArray', '#[#]', |
| 2650 _typeData, JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG()); | 2650 _typeData, JS_GET_NAME(JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS _TAG)); |
|
herhut
2015/06/03 08:58:28
Long line...
| |
| 2651 } | 2651 } |
| 2652 | 2652 |
| 2653 bool get _hasOptionalArguments { | 2653 bool get _hasOptionalArguments { |
| 2654 return JS('bool', '# in #', | 2654 return JS('bool', '# in #', |
| 2655 JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG(), _typeData); | 2655 JS_GET_NAME(JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG), _typ eData); |
|
herhut
2015/06/03 08:58:28
Long line...
| |
| 2656 } | 2656 } |
| 2657 List get _optionalArguments { | 2657 List get _optionalArguments { |
| 2658 return JS('JSExtendableArray', '#[#]', | 2658 return JS('JSExtendableArray', '#[#]', |
| 2659 _typeData, JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG()); | 2659 _typeData, JS_GET_NAME(JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS _TAG)); |
|
herhut
2015/06/03 08:58:28
Long line...
| |
| 2660 } | 2660 } |
| 2661 | 2661 |
| 2662 bool get _hasNamedArguments { | 2662 bool get _hasNamedArguments { |
| 2663 return JS('bool', '# in #', | 2663 return JS('bool', '# in #', |
|
herhut
2015/06/03 08:58:28
Long line...
| |
| 2664 JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG(), _typeData); | 2664 JS_GET_NAME(JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG), _typeDa ta); |
| 2665 } | 2665 } |
| 2666 get _namedArguments { | 2666 get _namedArguments { |
| 2667 return JS('=Object', '#[#]', | 2667 return JS('=Object', '#[#]', |
| 2668 _typeData, JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()); | 2668 _typeData, JS_GET_NAME(JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TA G)); |
|
herhut
2015/06/03 08:58:28
Long line...
| |
| 2669 } | 2669 } |
| 2670 | 2670 |
| 2671 bool get isOriginalDeclaration => true; | 2671 bool get isOriginalDeclaration => true; |
| 2672 | 2672 |
| 2673 bool get isAbstract => false; | 2673 bool get isAbstract => false; |
| 2674 | 2674 |
| 2675 bool get isEnum => false; | 2675 bool get isEnum => false; |
| 2676 | 2676 |
| 2677 TypeMirror get returnType { | 2677 TypeMirror get returnType { |
| 2678 if (_cachedReturnType != null) return _cachedReturnType; | 2678 if (_cachedReturnType != null) return _cachedReturnType; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2847 } | 2847 } |
| 2848 return typeArgument._mangledName; | 2848 return typeArgument._mangledName; |
| 2849 } | 2849 } |
| 2850 representation = | 2850 representation = |
| 2851 runtimeTypeToString(type, onTypeVariable: substituteTypeVariable); | 2851 runtimeTypeToString(type, onTypeVariable: substituteTypeVariable); |
| 2852 } | 2852 } |
| 2853 if (representation != null) { | 2853 if (representation != null) { |
| 2854 return reflectClassByMangledName( | 2854 return reflectClassByMangledName( |
| 2855 getMangledTypeName(createRuntimeType(representation))); | 2855 getMangledTypeName(createRuntimeType(representation))); |
| 2856 } | 2856 } |
| 2857 String typedefPropertyName = JS_TYPEDEF_TAG(); | 2857 String typedefPropertyName = JS_GET_NAME(JsGetName.TYPEDEF_TAG); |
| 2858 if (type != null && JS('', '#[#]', type, typedefPropertyName) != null) { | 2858 if (type != null && JS('', '#[#]', type, typedefPropertyName) != null) { |
| 2859 return typeMirrorFromRuntimeTypeRepresentation( | 2859 return typeMirrorFromRuntimeTypeRepresentation( |
| 2860 owner, JS('', '#[#]', type, typedefPropertyName)); | 2860 owner, JS('', '#[#]', type, typedefPropertyName)); |
| 2861 } else if (type != null && isDartFunctionType(type)) { | 2861 } else if (type != null && isDartFunctionType(type)) { |
| 2862 return new JsFunctionTypeMirror(type, owner); | 2862 return new JsFunctionTypeMirror(type, owner); |
| 2863 } | 2863 } |
| 2864 return reflectClass(Function); | 2864 return reflectClass(Function); |
| 2865 } | 2865 } |
| 2866 | 2866 |
| 2867 Symbol computeQualifiedName(DeclarationMirror owner, Symbol simpleName) { | 2867 Symbol computeQualifiedName(DeclarationMirror owner, Symbol simpleName) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3036 // have a part (following a '.') that starts with '_'. | 3036 // have a part (following a '.') that starts with '_'. |
| 3037 const int UNDERSCORE = 0x5f; | 3037 const int UNDERSCORE = 0x5f; |
| 3038 if (name.isEmpty) return true; | 3038 if (name.isEmpty) return true; |
| 3039 int index = -1; | 3039 int index = -1; |
| 3040 do { | 3040 do { |
| 3041 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; | 3041 if (name.codeUnitAt(index + 1) == UNDERSCORE) return false; |
| 3042 index = name.indexOf('.', index + 1); | 3042 index = name.indexOf('.', index + 1); |
| 3043 } while (index >= 0 && index + 1 < name.length); | 3043 } while (index >= 0 && index + 1 < name.length); |
| 3044 return true; | 3044 return true; |
| 3045 } | 3045 } |
| OLD | NEW |