| 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 //------------------------------------------------------------------------------ | 7 //------------------------------------------------------------------------------ |
| 8 // Member mirrors implementation. | 8 // Member mirrors implementation. |
| 9 //------------------------------------------------------------------------------ | 9 //------------------------------------------------------------------------------ |
| 10 | 10 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 if (hasDefaultValue) { | 197 if (hasDefaultValue) { |
| 198 // TODO(johnniwinther): Get the constant from the [TreeElements] | 198 // TODO(johnniwinther): Get the constant from the [TreeElements] |
| 199 // associated with the enclosing method. | 199 // associated with the enclosing method. |
| 200 ParameterElement parameter = _element; | 200 ParameterElement parameter = _element; |
| 201 ConstantExpression constant = mirrorSystem.compiler.constants | 201 ConstantExpression constant = mirrorSystem.compiler.constants |
| 202 .getConstantForVariable(parameter); | 202 .getConstantForVariable(parameter); |
| 203 assert(invariant(parameter, constant != null, | 203 assert(invariant(parameter, constant != null, |
| 204 message: "Missing constant for parameter " | 204 message: "Missing constant for parameter " |
| 205 "$parameter with default value.")); | 205 "$parameter with default value.")); |
| 206 return _convertConstantToInstanceMirror(mirrorSystem, | 206 return _convertConstantToInstanceMirror(mirrorSystem, |
| 207 constant, constant.value); | 207 constant, mirrorSystem.compiler.constants.getConstantValue(constant)); |
| 208 } | 208 } |
| 209 return null; | 209 return null; |
| 210 } | 210 } |
| 211 | 211 |
| 212 bool get hasDefaultValue { | 212 bool get hasDefaultValue { |
| 213 if (_element is ParameterElement) { | 213 if (_element is ParameterElement) { |
| 214 ParameterElement parameter = _element; | 214 ParameterElement parameter = _element; |
| 215 return parameter.initializer != null; | 215 return parameter.initializer != null; |
| 216 } | 216 } |
| 217 return false; | 217 return false; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 230 bool isNamed) | 230 bool isNamed) |
| 231 : super._normal(method, element, isOptional, isNamed); | 231 : super._normal(method, element, isOptional, isNamed); |
| 232 | 232 |
| 233 InitializingFormalElement get _fieldParameterElement => _element; | 233 InitializingFormalElement get _fieldParameterElement => _element; |
| 234 | 234 |
| 235 bool get isInitializingFormal => true; | 235 bool get isInitializingFormal => true; |
| 236 | 236 |
| 237 VariableMirror get initializedField => new Dart2JsFieldMirror( | 237 VariableMirror get initializedField => new Dart2JsFieldMirror( |
| 238 owner.owner, _fieldParameterElement.fieldElement); | 238 owner.owner, _fieldParameterElement.fieldElement); |
| 239 } | 239 } |
| OLD | NEW |