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

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

Issue 10557003: Fix most warnings and other minor cleanups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase. 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 interface Operation { 5 interface Operation {
6 final SourceString name; 6 final SourceString name;
7 bool isUserDefinable(); 7 bool isUserDefinable();
8 } 8 }
9 9
10 interface UnaryOperation extends Operation { 10 interface UnaryOperation extends Operation {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 NumConstant leftNum = left; 228 NumConstant leftNum = left;
229 NumConstant rightNum = right; 229 NumConstant rightNum = right;
230 return new DoubleConstant(leftNum.value + rightNum.value); 230 return new DoubleConstant(leftNum.value + rightNum.value);
231 } else if (left.isString() && !right.isObject()) { 231 } else if (left.isString() && !right.isObject()) {
232 PrimitiveConstant primitiveRight = right; 232 PrimitiveConstant primitiveRight = right;
233 DartString rightDartString = primitiveRight.toDartString(); 233 DartString rightDartString = primitiveRight.toDartString();
234 StringConstant leftString = left; 234 StringConstant leftString = left;
235 if (rightDartString.isEmpty()) { 235 if (rightDartString.isEmpty()) {
236 return left; 236 return left;
237 } else if (leftString.value.isEmpty()) { 237 } else if (leftString.value.isEmpty()) {
238 // TODO(floitsch): There is no right.node. Find a node some other way. 238 return new StringConstant(rightDartString, leftString.node);
239 return new StringConstant(rightDartString, right.node);
240 } else { 239 } else {
241 DartString concatenated = 240 DartString concatenated =
242 new ConsDartString(leftString.value, rightDartString); 241 new ConsDartString(leftString.value, rightDartString);
243 return new StringConstant(concatenated, leftString.node); 242 return new StringConstant(concatenated, leftString.node);
244 } 243 }
245 } else { 244 } else {
246 return null; 245 return null;
247 } 246 }
248 } 247 }
249 } 248 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 bool isUserDefinable() => false; 313 bool isUserDefinable() => false;
315 const IdentityOperation(); 314 const IdentityOperation();
316 Constant fold(Constant left, Constant right) { 315 Constant fold(Constant left, Constant right) {
317 // In order to preserve runtime semantics which says that NaN !== NaN don't 316 // In order to preserve runtime semantics which says that NaN !== NaN don't
318 // constant fold NaN === NaN. Otherwise the output depends on inlined 317 // constant fold NaN === NaN. Otherwise the output depends on inlined
319 // variables and other optimizations. 318 // variables and other optimizations.
320 if (left.isNaN() && right.isNaN()) return null; 319 if (left.isNaN() && right.isNaN()) return null;
321 return new BoolConstant(left == right); 320 return new BoolConstant(left == right);
322 } 321 }
323 } 322 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/native_handler.dart ('k') | lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698