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

Side by Side Diff: dart/lib/compiler/implementation/compile_time_constants.dart

Issue 10553007: Remove support for String operator + from dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update co19 status Created 8 years, 6 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
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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 if (folded === null) error(send); 862 if (folded === null) error(send);
863 return folded; 863 return folded;
864 } else if (send.isOperator && !send.isPostfix) { 864 } else if (send.isOperator && !send.isPostfix) {
865 assert(send.argumentCount() == 1); 865 assert(send.argumentCount() == 1);
866 Constant left = evaluate(send.receiver); 866 Constant left = evaluate(send.receiver);
867 Constant right = evaluate(send.argumentsNode.nodes.head); 867 Constant right = evaluate(send.argumentsNode.nodes.head);
868 Operator op = send.selector.asOperator(); 868 Operator op = send.selector.asOperator();
869 Constant folded = null; 869 Constant folded = null;
870 switch (op.source.stringValue) { 870 switch (op.source.stringValue) {
871 case "+": 871 case "+":
872 if (left.isString() && !right.isString()) {
873 // At the moment only compile-time concatenation of two strings is
874 // allowed.
875 error(send);
876 }
877 folded = const AddOperation().fold(left, right); 872 folded = const AddOperation().fold(left, right);
878 break; 873 break;
879 case "-": 874 case "-":
880 folded = const SubtractOperation().fold(left, right); 875 folded = const SubtractOperation().fold(left, right);
881 break; 876 break;
882 case "*": 877 case "*":
883 folded = const MultiplyOperation().fold(left, right); 878 folded = const MultiplyOperation().fold(left, right);
884 break; 879 break;
885 case "/": 880 case "/":
886 folded = const DivideOperation().fold(left, right); 881 folded = const DivideOperation().fold(left, right);
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 Constant fieldValue = fieldValues[field]; 1163 Constant fieldValue = fieldValues[field];
1169 if (fieldValue === null) { 1164 if (fieldValue === null) {
1170 // Use the default value. 1165 // Use the default value.
1171 fieldValue = compiler.compileVariable(field); 1166 fieldValue = compiler.compileVariable(field);
1172 } 1167 }
1173 jsNewArguments.add(fieldValue); 1168 jsNewArguments.add(fieldValue);
1174 }); 1169 });
1175 return jsNewArguments; 1170 return jsNewArguments;
1176 } 1171 }
1177 } 1172 }
OLDNEW
« no previous file with comments | « no previous file | dart/lib/compiler/implementation/lib/js_helper.dart » ('j') | dart/lib/compiler/implementation/lib/mockimpl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698