| OLD | NEW |
| 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 const DART_CONSTANT_SYSTEM = const DartConstantSystem(); | 7 const DART_CONSTANT_SYSTEM = const DartConstantSystem(); |
| 8 | 8 |
| 9 class BitNotOperation implements UnaryOperation { | 9 class BitNotOperation implements UnaryOperation { |
| 10 final SourceString name = const SourceString('~'); | 10 final SourceString name = const SourceString('~'); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 apply(left, right) => left % right; | 200 apply(left, right) => left % right; |
| 201 } | 201 } |
| 202 | 202 |
| 203 class TruncatingDivideOperation extends ArithmeticNumOperation { | 203 class TruncatingDivideOperation extends ArithmeticNumOperation { |
| 204 final SourceString name = const SourceString('~/'); | 204 final SourceString name = const SourceString('~/'); |
| 205 const TruncatingDivideOperation(); | 205 const TruncatingDivideOperation(); |
| 206 int foldInts(int left, int right) { | 206 int foldInts(int left, int right) { |
| 207 if (right == 0) return null; | 207 if (right == 0) return null; |
| 208 return left ~/ right; | 208 return left ~/ right; |
| 209 } | 209 } |
| 210 num foldNums(num left, num right) => left ~/ right; | 210 num foldNums(num left, num right) { |
| 211 num ratio = left / right; |
| 212 if (ratio.isNaN || ratio.isInfinite) return null; |
| 213 return ratio.truncate().toInt(); |
| 214 } |
| 211 apply(left, right) => left ~/ right; | 215 apply(left, right) => left ~/ right; |
| 212 } | 216 } |
| 213 | 217 |
| 214 class DivideOperation extends ArithmeticNumOperation { | 218 class DivideOperation extends ArithmeticNumOperation { |
| 215 final SourceString name = const SourceString('/'); | 219 final SourceString name = const SourceString('/'); |
| 216 const DivideOperation(); | 220 const DivideOperation(); |
| 217 num foldNums(num left, num right) => left / right; | 221 num foldNums(num left, num right) => left / right; |
| 218 bool isDivide() => true; | 222 bool isDivide() => true; |
| 219 apply(left, right) => left / right; | 223 apply(left, right) => left / right; |
| 220 } | 224 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 bool isInt(Constant constant) => constant.isInt(); | 368 bool isInt(Constant constant) => constant.isInt(); |
| 365 bool isDouble(Constant constant) => constant.isDouble(); | 369 bool isDouble(Constant constant) => constant.isDouble(); |
| 366 bool isString(Constant constant) => constant.isString(); | 370 bool isString(Constant constant) => constant.isString(); |
| 367 bool isBool(Constant constant) => constant.isBool(); | 371 bool isBool(Constant constant) => constant.isBool(); |
| 368 bool isNull(Constant constant) => constant.isNull(); | 372 bool isNull(Constant constant) => constant.isNull(); |
| 369 | 373 |
| 370 bool isSubtype(Compiler compiler, DartType s, DartType t) { | 374 bool isSubtype(Compiler compiler, DartType s, DartType t) { |
| 371 return compiler.types.isSubtype(s, t); | 375 return compiler.types.isSubtype(s, t); |
| 372 } | 376 } |
| 373 } | 377 } |
| OLD | NEW |