Chromium Code Reviews| 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 abstract class Operation { | 7 abstract class Operation { |
| 8 String get name; | 8 String get name; |
| 9 bool isUserDefinable(); | |
| 10 } | 9 } |
| 11 | 10 |
| 12 abstract class UnaryOperation extends Operation { | 11 abstract class UnaryOperation extends Operation { |
| 13 /** Returns [:null:] if it was unable to fold the operation. */ | 12 /** Returns [:null:] if it was unable to fold the operation. */ |
| 14 Constant fold(Constant constant); | 13 Constant fold(Constant constant); |
| 15 apply(value); | |
|
Johnni Winther
2013/12/03 11:52:31
Seems strange to remove this when BinaryOperation.
ahe
2013/12/04 11:45:43
Perhaps, but this method has a problematic name be
| |
| 16 } | 14 } |
| 17 | 15 |
| 18 abstract class BinaryOperation extends Operation { | 16 abstract class BinaryOperation extends Operation { |
| 19 /** Returns [:null:] if it was unable to fold the operation. */ | 17 /** Returns [:null:] if it was unable to fold the operation. */ |
| 20 Constant fold(Constant left, Constant right); | 18 Constant fold(Constant left, Constant right); |
| 21 apply(left, right); | 19 apply(left, right); |
| 22 } | 20 } |
| 23 | 21 |
| 24 /** | 22 /** |
| 25 * A [ConstantSystem] is responsible for creating constants and folding them. | 23 * A [ConstantSystem] is responsible for creating constants and folding them. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 bool isBool(Constant constant); | 68 bool isBool(Constant constant); |
| 71 /** Returns true if the [constant] is null at runtime. */ | 69 /** Returns true if the [constant] is null at runtime. */ |
| 72 bool isNull(Constant constant); | 70 bool isNull(Constant constant); |
| 73 | 71 |
| 74 Operation lookupUnary(String operator) { | 72 Operation lookupUnary(String operator) { |
| 75 if (operator == '-') return negate; | 73 if (operator == '-') return negate; |
| 76 if (operator == '~') return bitNot; | 74 if (operator == '~') return bitNot; |
| 77 return null; | 75 return null; |
| 78 } | 76 } |
| 79 } | 77 } |
| OLD | NEW |