OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // TODO(johnniwinther): Remove this library when all constant constructors are | 5 // TODO(johnniwinther): Remove this library when all constant constructors are |
6 // computed during resolution. | 6 // computed during resolution. |
7 library dart2js.constants.constant_constructors; | 7 library dart2js.constants.constant_constructors; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 thisConstructor, callStructure, argumentExpression); | 261 thisConstructor, callStructure, argumentExpression); |
262 } | 262 } |
263 | 263 |
264 @override | 264 @override |
265 ConstantExpression visitBinary( | 265 ConstantExpression visitBinary( |
266 Send node, Node left, BinaryOperator operator, Node right, _) { | 266 Send node, Node left, BinaryOperator operator, Node right, _) { |
267 return new BinaryConstantExpression(apply(left), operator, apply(right)); | 267 return new BinaryConstantExpression(apply(left), operator, apply(right)); |
268 } | 268 } |
269 | 269 |
270 @override | 270 @override |
| 271 ConstantExpression visitEquals(Send node, Node left, Node right, _) { |
| 272 return new BinaryConstantExpression( |
| 273 apply(left), BinaryOperator.EQ, apply(right)); |
| 274 } |
| 275 |
| 276 @override |
| 277 ConstantExpression visitNotEquals(Send node, Node left, Node right, _) { |
| 278 return new BinaryConstantExpression( |
| 279 apply(left), BinaryOperator.NOT_EQ, apply(right)); |
| 280 } |
| 281 |
| 282 @override |
271 ConstantExpression visitUnary( | 283 ConstantExpression visitUnary( |
272 Send node, UnaryOperator operator, Node expression, _) { | 284 Send node, UnaryOperator operator, Node expression, _) { |
273 return new UnaryConstantExpression(operator, apply(expression)); | 285 return new UnaryConstantExpression(operator, apply(expression)); |
274 } | 286 } |
275 | 287 |
276 @override | 288 @override |
277 ConstantExpression visitStaticFieldGet(Send node, FieldElement field, _) { | 289 ConstantExpression visitStaticFieldGet(Send node, FieldElement field, _) { |
278 return new VariableConstantExpression(field); | 290 return new VariableConstantExpression(field); |
279 } | 291 } |
280 | 292 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 ConstantExpression visitNamedArgument(NamedArgument node) { | 350 ConstantExpression visitNamedArgument(NamedArgument node) { |
339 return apply(node.expression); | 351 return apply(node.expression); |
340 } | 352 } |
341 | 353 |
342 @override | 354 @override |
343 ConstantExpression visitIfNull(Send node, Node left, Node right, _) { | 355 ConstantExpression visitIfNull(Send node, Node left, Node right, _) { |
344 return new BinaryConstantExpression( | 356 return new BinaryConstantExpression( |
345 apply(left), BinaryOperator.IF_NULL, apply(right)); | 357 apply(left), BinaryOperator.IF_NULL, apply(right)); |
346 } | 358 } |
347 } | 359 } |
OLD | NEW |