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 part of dart2js.mirrors; | 5 part of dart2js.mirrors; |
6 | 6 |
7 abstract class ObjectMirrorMixin implements ObjectMirror { | 7 abstract class ObjectMirrorMixin implements ObjectMirror { |
8 InstanceMirror getField(Symbol fieldName) { | 8 InstanceMirror getField(Symbol fieldName) { |
9 throw new UnsupportedError('ObjectMirror.getField unsupported.'); | 9 throw new UnsupportedError('ObjectMirror.getField unsupported.'); |
10 } | 10 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 class Dart2JsConstantMirror extends Object | 66 class Dart2JsConstantMirror extends Object |
67 with ObjectMirrorMixin, InstanceMirrorMixin { | 67 with ObjectMirrorMixin, InstanceMirrorMixin { |
68 final Dart2JsMirrorSystem mirrorSystem; | 68 final Dart2JsMirrorSystem mirrorSystem; |
69 final ConstantExpression _constant; | 69 final ConstantExpression _constant; |
70 final ConstantValue _value; | 70 final ConstantValue _value; |
71 | 71 |
72 Dart2JsConstantMirror(this.mirrorSystem, this._constant, this._value); | 72 Dart2JsConstantMirror(this.mirrorSystem, this._constant, this._value); |
73 | 73 |
74 String toString() { | 74 String toString() { |
75 if (_constant != null) { | 75 if (_constant != null) { |
76 return _constant.getText(); | 76 return _constant.toDartText(); |
77 } else { | 77 } else { |
78 return _value.unparse(); | 78 return _value.toDartText(); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 ClassMirror get type { | 82 ClassMirror get type { |
83 return mirrorSystem._getTypeDeclarationMirror( | 83 return mirrorSystem._getTypeDeclarationMirror( |
84 _value.getType(mirrorSystem.compiler.coreTypes).element); | 84 _value.getType(mirrorSystem.compiler.coreTypes).element); |
85 } | 85 } |
86 | 86 |
87 int get hashCode => 13 * _constant.hashCode; | 87 int get hashCode => 13 * _constant.hashCode; |
88 | 88 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 return new Dart2JsBoolConstantMirror.fromBool(mirrorSystem, isDocComment); | 277 return new Dart2JsBoolConstantMirror.fromBool(mirrorSystem, isDocComment); |
278 } else if (fieldName == #text) { | 278 } else if (fieldName == #text) { |
279 return new Dart2JsStringConstantMirror.fromString(mirrorSystem, text); | 279 return new Dart2JsStringConstantMirror.fromString(mirrorSystem, text); |
280 } else if (fieldName == #trimmedText) { | 280 } else if (fieldName == #trimmedText) { |
281 return new Dart2JsStringConstantMirror.fromString( | 281 return new Dart2JsStringConstantMirror.fromString( |
282 mirrorSystem, trimmedText); | 282 mirrorSystem, trimmedText); |
283 } | 283 } |
284 return super.getField(fieldName); | 284 return super.getField(fieldName); |
285 } | 285 } |
286 } | 286 } |
OLD | NEW |