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

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

Issue 1919143002: Store constant variable initializers in elements. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 7 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js.mirrors; 5 library dart2js.mirrors;
6 6
7 import 'dart:collection' show UnmodifiableListView, UnmodifiableMapView; 7 import 'dart:collection' show UnmodifiableListView, UnmodifiableMapView;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 .mapToList((cu) => new Dart2JsCompilationUnitMirror(cu, library)); 456 .mapToList((cu) => new Dart2JsCompilationUnitMirror(cu, library));
457 } 457 }
458 458
459 static Iterable<ConstantExpression> metadataSyntaxOf( 459 static Iterable<ConstantExpression> metadataSyntaxOf(
460 Dart2JsElementMirror declaration) { 460 Dart2JsElementMirror declaration) {
461 return declaration._element.metadata.map((metadata) => metadata.constant); 461 return declaration._element.metadata.map((metadata) => metadata.constant);
462 } 462 }
463 463
464 static ConstantExpression initializerSyntaxOf(Dart2JsFieldMirror variable) { 464 static ConstantExpression initializerSyntaxOf(Dart2JsFieldMirror variable) {
465 Compiler compiler = variable.mirrorSystem.compiler; 465 Compiler compiler = variable.mirrorSystem.compiler;
466 return compiler.constants.getConstantForVariable(variable._variable); 466 return variable._variable.constant;
467 } 467 }
468 468
469 static ConstantExpression defaultValueSyntaxOf( 469 static ConstantExpression defaultValueSyntaxOf(
470 Dart2JsParameterMirror parameter) { 470 Dart2JsParameterMirror parameter) {
471 if (!parameter.hasDefaultValue) return null; 471 if (!parameter.hasDefaultValue) return null;
472 ParameterElement parameterElement = parameter._element; 472 ParameterElement parameterElement = parameter._element;
473 Compiler compiler = parameter.mirrorSystem.compiler; 473 Compiler compiler = parameter.mirrorSystem.compiler;
474 return compiler.constants.getConstantForVariable(parameterElement); 474 return parameterElement.constant;
475 } 475 }
476 476
477 static Mirror getMirrorFromElement(Dart2JsMirror mirror, Element element) { 477 static Mirror getMirrorFromElement(Dart2JsMirror mirror, Element element) {
478 return _convertElementToDeclarationMirror(mirror.mirrorSystem, element); 478 return _convertElementToDeclarationMirror(mirror.mirrorSystem, element);
479 } 479 }
480 } 480 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/mirrors/dart2js_member_mirrors.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698