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

Side by Side Diff: frog/leg/compile_time_constants.dart

Issue 9810027: Allow constant folding of && and ||. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 | frog/leg/operations.dart » ('j') | frog/leg/operations.dart » ('J')
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 class Constant implements Hashable { 5 class Constant implements Hashable {
6 const Constant(); 6 const Constant();
7 7
8 bool isNull() => false; 8 bool isNull() => false;
9 bool isBool() => false; 9 bool isBool() => false;
10 bool isTrue() => false; 10 bool isTrue() => false;
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 break; 871 break;
872 case "|": 872 case "|":
873 folded = const BitOrOperation().fold(left, right); 873 folded = const BitOrOperation().fold(left, right);
874 break; 874 break;
875 case "&": 875 case "&":
876 folded = const BitAndOperation().fold(left, right); 876 folded = const BitAndOperation().fold(left, right);
877 break; 877 break;
878 case "^": 878 case "^":
879 folded = const BitXorOperation().fold(left, right); 879 folded = const BitXorOperation().fold(left, right);
880 break; 880 break;
881 case "||":
882 folded = const BooleanOr().fold(left, right);
883 break;
884 case "&&":
885 folded = const BooleanAnd().fold(left, right);
886 break;
881 case "<<": 887 case "<<":
882 folded = const ShiftLeftOperation().fold(left, right); 888 folded = const ShiftLeftOperation().fold(left, right);
883 break; 889 break;
884 case ">>": 890 case ">>":
885 folded = const ShiftRightOperation().fold(left, right); 891 folded = const ShiftRightOperation().fold(left, right);
886 break; 892 break;
887 case "<": 893 case "<":
888 folded = const LessOperation().fold(left, right); 894 folded = const LessOperation().fold(left, right);
889 break; 895 break;
890 case "<=": 896 case "<=":
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 return node.expression.accept(this); 1066 return node.expression.accept(this);
1061 } 1067 }
1062 1068
1063 error(Node node) { 1069 error(Node node) {
1064 // TODO(floitsch): get the list of constants that are currently compiled 1070 // TODO(floitsch): get the list of constants that are currently compiled
1065 // and present some kind of stack-trace. 1071 // and present some kind of stack-trace.
1066 MessageKind kind = MessageKind.NOT_A_COMPILE_TIME_CONSTANT; 1072 MessageKind kind = MessageKind.NOT_A_COMPILE_TIME_CONSTANT;
1067 compiler.reportError(node, new CompileTimeConstantError(kind, const [])); 1073 compiler.reportError(node, new CompileTimeConstantError(kind, const []));
1068 } 1074 }
1069 } 1075 }
OLDNEW
« no previous file with comments | « no previous file | frog/leg/operations.dart » ('j') | frog/leg/operations.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698