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

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

Issue 10389143: Add locations to diagnostics. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove all references to unreachable() Created 8 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 | 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 return new StringConstant(rightDartString); 238 return new StringConstant(rightDartString, right.node);
239 } else { 239 } else {
240 DartString concatenated = 240 DartString concatenated =
241 new ConsDartString(leftString.value, rightDartString); 241 new ConsDartString(leftString.value, rightDartString);
242 return new StringConstant(concatenated); 242 return new StringConstant(concatenated, leftString.node);
243 } 243 }
244 } else { 244 } else {
245 return null; 245 return null;
246 } 246 }
247 } 247 }
248 } 248 }
249 249
250 class RelationalNumOperation implements BinaryOperation { 250 class RelationalNumOperation implements BinaryOperation {
251 bool isUserDefinable() => true; 251 bool isUserDefinable() => true;
252 const RelationalNumOperation(); 252 const RelationalNumOperation();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 bool isUserDefinable() => false; 313 bool isUserDefinable() => false;
314 const IdentityOperation(); 314 const IdentityOperation();
315 Constant fold(Constant left, Constant right) { 315 Constant fold(Constant left, Constant right) {
316 // 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
317 // constant fold NaN === NaN. Otherwise the output depends on inlined 317 // constant fold NaN === NaN. Otherwise the output depends on inlined
318 // variables and other optimizations. 318 // variables and other optimizations.
319 if (left.isNaN() && right.isNaN()) return null; 319 if (left.isNaN() && right.isNaN()) return null;
320 return new BoolConstant(left == right); 320 return new BoolConstant(left == right);
321 } 321 }
322 } 322 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/leg.dart ('k') | dart/lib/compiler/implementation/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698