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

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

Issue 1994613004: Handle use of constant constructors with default values. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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) 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 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 VariableDefinitions parseNode(Element element, ParsingContext parsing) { 1386 VariableDefinitions parseNode(Element element, ParsingContext parsing) {
1387 return definitions; 1387 return definitions;
1388 } 1388 }
1389 1389
1390 DartType computeType(Element element, Resolution resolution) => type; 1390 DartType computeType(Element element, Resolution resolution) => type;
1391 } 1391 }
1392 1392
1393 abstract class ConstantVariableMixin implements VariableElement { 1393 abstract class ConstantVariableMixin implements VariableElement {
1394 ConstantExpression constantCache; 1394 ConstantExpression constantCache;
1395 1395
1396 // TODO(johnniwinther): Update the on `constant = ...` when evaluation of
1397 // constant expression can handle references to unanalyzed constant variables.
1398 @override
1399 bool get hasConstant => false;
1400
1396 ConstantExpression get constant { 1401 ConstantExpression get constant {
1397 if (isPatch) { 1402 if (isPatch) {
1398 ConstantVariableMixin originVariable = origin; 1403 ConstantVariableMixin originVariable = origin;
1399 return originVariable.constant; 1404 return originVariable.constant;
1400 } 1405 }
1401 assert(invariant(this, !isConst || constantCache != null, 1406 assert(invariant(this, !isConst || constantCache != null,
1402 message: "Constant has not been computed for $this.")); 1407 message: "Constant has not been computed for $this."));
1403 return constantCache; 1408 return constantCache;
1404 } 1409 }
1405 1410
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after
3288 body = node.asFunctionExpression().body; 3293 body = node.asFunctionExpression().body;
3289 } 3294 }
3290 return new ParsedResolvedAst( 3295 return new ParsedResolvedAst(
3291 declaration, 3296 declaration,
3292 node, 3297 node,
3293 body, 3298 body,
3294 definingElement.treeElements, 3299 definingElement.treeElements,
3295 definingElement.compilationUnit.script.resourceUri); 3300 definingElement.compilationUnit.script.resourceUri);
3296 } 3301 }
3297 } 3302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698