| 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'; |
| 11 import '../elements/elements.dart'; | 11 import '../elements/elements.dart'; |
| 12 import '../resolution/operators.dart'; | 12 import '../resolution/operators.dart'; |
| 13 import '../resolution/semantic_visitor.dart'; | 13 import '../resolution/semantic_visitor.dart'; |
| 14 import '../resolution/send_resolver.dart' show DeclarationResolverMixin; | 14 import '../resolution/send_resolver.dart' show DeclarationResolverMixin; |
| 15 import '../resolution/send_structure.dart'; | 15 import '../resolution/send_structure.dart'; |
| 16 import '../resolution/tree_elements.dart' show TreeElements; | 16 import '../resolution/tree_elements.dart' show TreeElements; |
| 17 import '../tree/tree.dart'; | 17 import '../tree/tree.dart'; |
| 18 import '../universe/call_structure.dart' show CallStructure; | 18 import '../universe/call_structure.dart' show CallStructure; |
| 19 | |
| 20 import 'constructors.dart'; | 19 import 'constructors.dart'; |
| 21 import 'expressions.dart'; | 20 import 'expressions.dart'; |
| 22 | 21 |
| 23 ConstantConstructor computeConstantConstructor(ResolvedAst resolvedAst) { | 22 ConstantConstructor computeConstantConstructor(ResolvedAst resolvedAst) { |
| 24 ConstantConstructorComputer visitor = | 23 ConstantConstructorComputer visitor = |
| 25 new ConstantConstructorComputer(resolvedAst.elements); | 24 new ConstantConstructorComputer(resolvedAst.elements); |
| 26 return resolvedAst.node.accept(visitor); | 25 return resolvedAst.node.accept(visitor); |
| 27 } | 26 } |
| 28 | 27 |
| 29 class ConstantConstructorComputer extends SemanticVisitor | 28 class ConstantConstructorComputer extends SemanticVisitor |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 ConstantExpression visitNamedArgument(NamedArgument node) { | 338 ConstantExpression visitNamedArgument(NamedArgument node) { |
| 340 return apply(node.expression); | 339 return apply(node.expression); |
| 341 } | 340 } |
| 342 | 341 |
| 343 @override | 342 @override |
| 344 ConstantExpression visitIfNull(Send node, Node left, Node right, _) { | 343 ConstantExpression visitIfNull(Send node, Node left, Node right, _) { |
| 345 return new BinaryConstantExpression( | 344 return new BinaryConstantExpression( |
| 346 apply(left), BinaryOperator.IF_NULL, apply(right)); | 345 apply(left), BinaryOperator.IF_NULL, apply(right)); |
| 347 } | 346 } |
| 348 } | 347 } |
| OLD | NEW |