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

Side by Side Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 2118763002: Revert "Handle fields with initializers in constant constructors." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/names.dart' show Identifiers; 8 import '../common/names.dart' show Identifiers;
9 import '../common/resolution.dart' show Resolution, ParsingContext; 9 import '../common/resolution.dart' show Resolution, ParsingContext;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 ConstantVariableMixin originVariable = origin; 1418 ConstantVariableMixin originVariable = origin;
1419 originVariable.constant = value; 1419 originVariable.constant = value;
1420 return; 1420 return;
1421 } 1421 }
1422 if (constantCache != null && 1422 if (constantCache != null &&
1423 constantCache.kind == ConstantExpressionKind.ERRONEOUS) { 1423 constantCache.kind == ConstantExpressionKind.ERRONEOUS) {
1424 // TODO(johnniwinther): Find out why we sometimes compute a non-erroneous 1424 // TODO(johnniwinther): Find out why we sometimes compute a non-erroneous
1425 // constant for a variable already known to be erroneous. 1425 // constant for a variable already known to be erroneous.
1426 return; 1426 return;
1427 } 1427 }
1428 if (constantCache != null && constantCache != value) { 1428 assert(invariant(this, constantCache == null || constantCache == value,
1429 // Allow setting the constant as erroneous. Constants computed during 1429 message: "Constant has already been computed for $this. "
1430 // resolution are locally valid but might be effectively erroneous. For 1430 "Existing constant: "
1431 // instance `a ? true : false` where a is `const a = m()`. Since `a` is 1431 "${constantCache != null ? constantCache.toStructuredText() : ''}, "
1432 // declared to be constant, the conditional is assumed valid, but when 1432 "New constant: ${value != null ? value.toStructuredText() : ''}."));
1433 // computing the value we see that it isn't.
1434 // TODO(johnniwinther): Remove this exception when all constant
1435 // expressions are computed during resolution.
1436 assert(invariant(this, value.kind == ConstantExpressionKind.ERRONEOUS,
1437 message: "Constant has already been computed for $this. "
1438 "Existing constant: "
1439 "${constantCache != null ? constantCache.toStructuredText() : ''}"
1440 ", New constant: "
1441 "${value != null ? value.toStructuredText() : ''}."));
1442 }
1443 constantCache = value; 1433 constantCache = value;
1444 } 1434 }
1445 } 1435 }
1446 1436
1447 abstract class VariableElementX extends ElementX 1437 abstract class VariableElementX extends ElementX
1448 with AstElementMixin, ConstantVariableMixin 1438 with AstElementMixin, ConstantVariableMixin
1449 implements VariableElement { 1439 implements VariableElement {
1450 final Token token; 1440 final Token token;
1451 final VariableList variables; 1441 final VariableList variables;
1452 VariableDefinitions definitionsCache; 1442 VariableDefinitions definitionsCache;
(...skipping 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after
3317 body = node.asFunctionExpression().body; 3307 body = node.asFunctionExpression().body;
3318 } 3308 }
3319 return new ParsedResolvedAst( 3309 return new ParsedResolvedAst(
3320 declaration, 3310 declaration,
3321 node, 3311 node,
3322 body, 3312 body,
3323 definingElement.treeElements, 3313 definingElement.treeElements,
3324 definingElement.compilationUnit.script.resourceUri); 3314 definingElement.compilationUnit.script.resourceUri);
3325 } 3315 }
3326 } 3316 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/constants/constant_constructors.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698