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

Side by Side Diff: dart/pkg/compiler/lib/src/compile_time_constants.dart

Issue 841953002: Quick work around dart2js crashes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 part of dart2js; 5 part of dart2js;
6 6
7 /// A [ConstantEnvironment] provides access for constants compiled for variable 7 /// A [ConstantEnvironment] provides access for constants compiled for variable
8 /// initializers. 8 /// initializers.
9 abstract class ConstantEnvironment { 9 abstract class ConstantEnvironment {
10 /// Returns the constant for the initializer of [element]. 10 /// Returns the constant for the initializer of [element].
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 AstConstant visitConditional(Conditional node) { 603 AstConstant visitConditional(Conditional node) {
604 AstConstant condition = evaluate(node.condition); 604 AstConstant condition = evaluate(node.condition);
605 if (condition == null) { 605 if (condition == null) {
606 return null; 606 return null;
607 } else if (!condition.value.isBool) { 607 } else if (!condition.value.isBool) {
608 DartType conditionType = condition.value.getType(compiler.coreTypes); 608 DartType conditionType = condition.value.getType(compiler.coreTypes);
609 if (isEvaluatingConstant) { 609 if (isEvaluatingConstant) {
610 compiler.reportError( 610 compiler.reportError(
611 node.condition, MessageKind.NOT_ASSIGNABLE, 611 node.condition, MessageKind.NOT_ASSIGNABLE,
612 {'fromType': conditionType, 'toType': compiler.boolClass.rawType}); 612 {'fromType': conditionType, 'toType': compiler.boolClass.rawType});
613 // TODO(ahe): Don't throw, recover from error.
614 throw new CompilerCancelledException(null);
613 } 615 }
614 return null; 616 return null;
615 } 617 }
616 AstConstant thenExpression = evaluate(node.thenExpression); 618 AstConstant thenExpression = evaluate(node.thenExpression);
617 AstConstant elseExpression = evaluate(node.elseExpression); 619 AstConstant elseExpression = evaluate(node.elseExpression);
618 if (thenExpression == null || elseExpression == null) { 620 if (thenExpression == null || elseExpression == null) {
619 return null; 621 return null;
620 } 622 }
621 BoolConstantValue boolCondition = condition.value; 623 BoolConstantValue boolCondition = condition.value;
622 return new AstConstant( 624 return new AstConstant(
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 return new AstConstant( 1101 return new AstConstant(
1100 element, 1102 element,
1101 element.initializer != null ? element.initializer : element.node, 1103 element.initializer != null ? element.initializer : element.node,
1102 constant); 1104 constant);
1103 } 1105 }
1104 1106
1105 ConstantValue get value => expression.value; 1107 ConstantValue get value => expression.value;
1106 1108
1107 String toString() => expression.toString(); 1109 String toString() => expression.toString();
1108 } 1110 }
OLDNEW
« no previous file with comments | « no previous file | dart/pkg/compiler/lib/src/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698