| 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 interface Operation { | 7 abstract class Operation { |
| 8 final SourceString name; | 8 SourceString get name; |
| 9 bool isUserDefinable(); | 9 bool isUserDefinable(); |
| 10 } | 10 } |
| 11 | 11 |
| 12 interface UnaryOperation extends Operation { | 12 abstract class UnaryOperation extends Operation { |
| 13 /** Returns [:null:] if it was unable to fold the operation. */ | 13 /** Returns [:null:] if it was unable to fold the operation. */ |
| 14 Constant fold(Constant constant); | 14 Constant fold(Constant constant); |
| 15 apply(value); | 15 apply(value); |
| 16 } | 16 } |
| 17 | 17 |
| 18 interface BinaryOperation extends Operation { | 18 abstract class BinaryOperation extends Operation { |
| 19 /** Returns [:null:] if it was unable to fold the operation. */ | 19 /** Returns [:null:] if it was unable to fold the operation. */ |
| 20 Constant fold(Constant left, Constant right); | 20 Constant fold(Constant left, Constant right); |
| 21 apply(left, right); | 21 apply(left, right); |
| 22 } | 22 } |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * A [ConstantSystem] is responsible for creating constants and folding them. | 25 * A [ConstantSystem] is responsible for creating constants and folding them. |
| 26 */ | 26 */ |
| 27 interface ConstantSystem { | 27 abstract class ConstantSystem { |
| 28 BinaryOperation get add; | 28 BinaryOperation get add; |
| 29 BinaryOperation get bitAnd; | 29 BinaryOperation get bitAnd; |
| 30 UnaryOperation get bitNot; | 30 UnaryOperation get bitNot; |
| 31 BinaryOperation get bitOr; | 31 BinaryOperation get bitOr; |
| 32 BinaryOperation get bitXor; | 32 BinaryOperation get bitXor; |
| 33 BinaryOperation get booleanAnd; | 33 BinaryOperation get booleanAnd; |
| 34 BinaryOperation get booleanOr; | 34 BinaryOperation get booleanOr; |
| 35 BinaryOperation get divide; | 35 BinaryOperation get divide; |
| 36 BinaryOperation get equal; | 36 BinaryOperation get equal; |
| 37 BinaryOperation get greaterEqual; | 37 BinaryOperation get greaterEqual; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 63 bool isInt(Constant constant); | 63 bool isInt(Constant constant); |
| 64 /** Returns true if the [constant] is a double at runtime. */ | 64 /** Returns true if the [constant] is a double at runtime. */ |
| 65 bool isDouble(Constant constant); | 65 bool isDouble(Constant constant); |
| 66 /** Returns true if the [constant] is a string at runtime. */ | 66 /** Returns true if the [constant] is a string at runtime. */ |
| 67 bool isString(Constant constant); | 67 bool isString(Constant constant); |
| 68 /** Returns true if the [constant] is a boolean at runtime. */ | 68 /** Returns true if the [constant] is a boolean at runtime. */ |
| 69 bool isBool(Constant constant); | 69 bool isBool(Constant constant); |
| 70 /** Returns true if the [constant] is null at runtime. */ | 70 /** Returns true if the [constant] is null at runtime. */ |
| 71 bool isNull(Constant constant); | 71 bool isNull(Constant constant); |
| 72 } | 72 } |
| OLD | NEW |