Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: pkg/compiler/lib/src/mirrors/dart2js_member_mirrors.dart

Issue 1148343004: Remove ConstantExpression.value (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Update comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/program_builder.dart ('k') | pkg/compiler/lib/src/mirrors/dart2js_mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698