| 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 '../elements/resolution_types.dart'; | 10 import '../elements/resolution_types.dart'; |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 280 } |
| 281 | 281 |
| 282 @override | 282 @override |
| 283 ConstantExpression visitUnary( | 283 ConstantExpression visitUnary( |
| 284 Send node, UnaryOperator operator, Node expression, _) { | 284 Send node, UnaryOperator operator, Node expression, _) { |
| 285 return new UnaryConstantExpression(operator, apply(expression)); | 285 return new UnaryConstantExpression(operator, apply(expression)); |
| 286 } | 286 } |
| 287 | 287 |
| 288 @override | 288 @override |
| 289 ConstantExpression visitStaticFieldGet(Send node, FieldElement field, _) { | 289 ConstantExpression visitStaticFieldGet(Send node, FieldElement field, _) { |
| 290 return new VariableConstantExpression(field); | 290 return new FieldConstantExpression(field); |
| 291 } | 291 } |
| 292 | 292 |
| 293 @override | 293 @override |
| 294 ConstantExpression visitTopLevelFunctionGet( | 294 ConstantExpression visitTopLevelFunctionGet( |
| 295 Send node, MethodElement method, _) { | 295 Send node, MethodElement method, _) { |
| 296 return new FunctionConstantExpression(method); | 296 return new FunctionConstantExpression(method, method.type); |
| 297 } | 297 } |
| 298 | 298 |
| 299 @override | 299 @override |
| 300 ConstantExpression visitTopLevelFieldGet(Send node, FieldElement field, _) { | 300 ConstantExpression visitTopLevelFieldGet(Send node, FieldElement field, _) { |
| 301 return new VariableConstantExpression(field); | 301 return new FieldConstantExpression(field); |
| 302 } | 302 } |
| 303 | 303 |
| 304 @override | 304 @override |
| 305 ConstantExpression visitLiteralInt(LiteralInt node) { | 305 ConstantExpression visitLiteralInt(LiteralInt node) { |
| 306 return new IntConstantExpression(node.value); | 306 return new IntConstantExpression(node.value); |
| 307 } | 307 } |
| 308 | 308 |
| 309 @override | 309 @override |
| 310 ConstantExpression visitLiteralDouble(LiteralDouble node) { | 310 ConstantExpression visitLiteralDouble(LiteralDouble node) { |
| 311 return new DoubleConstantExpression(node.value); | 311 return new DoubleConstantExpression(node.value); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 ConstantExpression visitNamedArgument(NamedArgument node) { | 356 ConstantExpression visitNamedArgument(NamedArgument node) { |
| 357 return apply(node.expression); | 357 return apply(node.expression); |
| 358 } | 358 } |
| 359 | 359 |
| 360 @override | 360 @override |
| 361 ConstantExpression visitIfNull(Send node, Node left, Node right, _) { | 361 ConstantExpression visitIfNull(Send node, Node left, Node right, _) { |
| 362 return new BinaryConstantExpression( | 362 return new BinaryConstantExpression( |
| 363 apply(left), BinaryOperator.IF_NULL, apply(right)); | 363 apply(left), BinaryOperator.IF_NULL, apply(right)); |
| 364 } | 364 } |
| 365 } | 365 } |
| OLD | NEW |