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

Side by Side Diff: pkg/compiler/lib/src/resolution/resolution.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.resolution; 5 library dart2js.resolution;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/names.dart' show Identifiers; 10 import '../common/names.dart' show Identifiers;
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } else { 369 } else {
370 // TODO(johnniwinther): Register a feature instead. 370 // TODO(johnniwinther): Register a feature instead.
371 registry.registerTypeUse(new TypeUse.instantiation(coreTypes.nullType)); 371 registry.registerTypeUse(new TypeUse.instantiation(coreTypes.nullType));
372 } 372 }
373 373
374 if (Elements.isStaticOrTopLevelField(element)) { 374 if (Elements.isStaticOrTopLevelField(element)) {
375 visitor.addDeferredAction(element, () { 375 visitor.addDeferredAction(element, () {
376 if (element.modifiers.isConst) { 376 if (element.modifiers.isConst) {
377 element.constant = constantCompiler.compileConstant(element); 377 element.constant = constantCompiler.compileConstant(element);
378 } else { 378 } else {
379 constantCompiler.compileVariable(element); 379 element.constant = constantCompiler.compileVariable(element);
380 } 380 }
381 }); 381 });
382 if (initializer != null) { 382 if (initializer != null) {
383 if (!element.modifiers.isConst) { 383 if (!element.modifiers.isConst) {
384 // TODO(johnniwinther): Determine the const-ness eagerly to avoid 384 // TODO(johnniwinther): Determine the const-ness eagerly to avoid
385 // unnecessary registrations. 385 // unnecessary registrations.
386 registry.registerFeature(Feature.LAZY_FIELD); 386 registry.registerFeature(Feature.LAZY_FIELD);
387 } 387 }
388 } 388 }
389 } 389 }
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 TreeElements get treeElements { 1090 TreeElements get treeElements {
1091 assert(invariant(this, _treeElements != null, 1091 assert(invariant(this, _treeElements != null,
1092 message: "TreeElements have not been computed for $this.")); 1092 message: "TreeElements have not been computed for $this."));
1093 return _treeElements; 1093 return _treeElements;
1094 } 1094 }
1095 1095
1096 void reuseElement() { 1096 void reuseElement() {
1097 _treeElements = null; 1097 _treeElements = null;
1098 } 1098 }
1099 } 1099 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/mirrors/dart2js_mirrors.dart ('k') | pkg/compiler/lib/src/serialization/element_serialization.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698