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

Side by Side Diff: pkg/compiler/lib/src/elements/modelx.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, 8 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 library elements.modelx; 5 library elements.modelx;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/resolution.dart' show Resolution, ParsingContext; 8 import '../common/resolution.dart' show Resolution, ParsingContext;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../constants/constant_constructors.dart'; 10 import '../constants/constant_constructors.dart';
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 } 1390 }
1391 1391
1392 abstract class ConstantVariableMixin implements VariableElement { 1392 abstract class ConstantVariableMixin implements VariableElement {
1393 ConstantExpression constantCache; 1393 ConstantExpression constantCache;
1394 1394
1395 ConstantExpression get constant { 1395 ConstantExpression get constant {
1396 if (isPatch) { 1396 if (isPatch) {
1397 ConstantVariableMixin originVariable = origin; 1397 ConstantVariableMixin originVariable = origin;
1398 return originVariable.constant; 1398 return originVariable.constant;
1399 } 1399 }
1400 assert(invariant(this, constantCache != null, 1400 assert(invariant(this, !isConst || constantCache != null,
1401 message: "Constant has not been computed for $this.")); 1401 message: "Constant has not been computed for $this."));
1402 return constantCache; 1402 return constantCache;
1403 } 1403 }
1404 1404
1405 void set constant(ConstantExpression value) { 1405 void set constant(ConstantExpression value) {
1406 if (isPatch) { 1406 if (isPatch) {
1407 ConstantVariableMixin originVariable = origin; 1407 ConstantVariableMixin originVariable = origin;
1408 originVariable.constant = value; 1408 originVariable.constant = value;
1409 return; 1409 return;
1410 } 1410 }
(...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after
3274 if (definingElement.isField) { 3274 if (definingElement.isField) {
3275 FieldElement field = definingElement; 3275 FieldElement field = definingElement;
3276 body = field.initializer; 3276 body = field.initializer;
3277 } else if (node != null && node.asFunctionExpression() != null) { 3277 } else if (node != null && node.asFunctionExpression() != null) {
3278 body = node.asFunctionExpression().body; 3278 body = node.asFunctionExpression().body;
3279 } 3279 }
3280 return new ParsedResolvedAst( 3280 return new ParsedResolvedAst(
3281 declaration, node, body, definingElement.treeElements); 3281 declaration, node, body, definingElement.treeElements);
3282 } 3282 }
3283 } 3283 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698