| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.constants.expressions; | 5 library dart2js.constants.expressions; |
| 6 | 6 |
| 7 import '../constants/constant_system.dart'; | 7 import '../constants/constant_system.dart'; |
| 8 import '../core_types.dart'; | 8 import '../core_types.dart'; |
| 9 import '../dart2jslib.dart' show assertDebugMode, Compiler; | 9 import '../dart2jslib.dart' show assertDebugMode, Compiler; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1524 R visitIntFromEnvironment(IntFromEnvironmentConstantExpression exp, | 1524 R visitIntFromEnvironment(IntFromEnvironmentConstantExpression exp, |
| 1525 A context); | 1525 A context); |
| 1526 R visitStringFromEnvironment(StringFromEnvironmentConstantExpression exp, | 1526 R visitStringFromEnvironment(StringFromEnvironmentConstantExpression exp, |
| 1527 A context); | 1527 A context); |
| 1528 R visitDeferred(DeferredConstantExpression exp, A context); | 1528 R visitDeferred(DeferredConstantExpression exp, A context); |
| 1529 | 1529 |
| 1530 R visitPositional(PositionalArgumentReference exp, A context); | 1530 R visitPositional(PositionalArgumentReference exp, A context); |
| 1531 R visitNamed(NamedArgumentReference exp, A context); | 1531 R visitNamed(NamedArgumentReference exp, A context); |
| 1532 } | 1532 } |
| 1533 | 1533 |
| 1534 /// Represents the declaration of a constant [element] with value [expression]. | |
| 1535 // TODO(johnniwinther): Where does this class belong? | |
| 1536 class ConstDeclaration { | |
| 1537 final VariableElement element; | |
| 1538 final ConstantExpression expression; | |
| 1539 | |
| 1540 ConstDeclaration(this.element, this.expression); | |
| 1541 } | |
| 1542 | |
| 1543 class ConstExpPrinter extends ConstantExpressionVisitor { | 1534 class ConstExpPrinter extends ConstantExpressionVisitor { |
| 1544 final StringBuffer sb = new StringBuffer(); | 1535 final StringBuffer sb = new StringBuffer(); |
| 1545 | 1536 |
| 1546 void write(ConstantExpression parent, | 1537 void write(ConstantExpression parent, |
| 1547 ConstantExpression child, | 1538 ConstantExpression child, |
| 1548 {bool leftAssociative: true}) { | 1539 {bool leftAssociative: true}) { |
| 1549 if (child.precedence < parent.precedence || | 1540 if (child.precedence < parent.precedence || |
| 1550 !leftAssociative && child.precedence == parent.precedence) { | 1541 !leftAssociative && child.precedence == parent.precedence) { |
| 1551 sb.write('('); | 1542 sb.write('('); |
| 1552 child.accept(this); | 1543 child.accept(this); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 visit(exp.name); | 1795 visit(exp.name); |
| 1805 if (exp.defaultValue != null) { | 1796 if (exp.defaultValue != null) { |
| 1806 sb.write(', defaultValue: '); | 1797 sb.write(', defaultValue: '); |
| 1807 visit(exp.defaultValue); | 1798 visit(exp.defaultValue); |
| 1808 } | 1799 } |
| 1809 sb.write(')'); | 1800 sb.write(')'); |
| 1810 } | 1801 } |
| 1811 | 1802 |
| 1812 String toString() => sb.toString(); | 1803 String toString() => sb.toString(); |
| 1813 } | 1804 } |
| OLD | NEW |