OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library kernel.ast_to_text; | 4 library kernel.ast_to_text; |
5 | 5 |
6 import '../ast.dart'; | 6 import '../ast.dart'; |
7 import '../import_table.dart'; | 7 import '../import_table.dart'; |
8 import '../type_propagation/type_propagation.dart'; | 8 import '../type_propagation/type_propagation.dart'; |
9 | 9 |
10 class Namer<T> { | 10 class Namer<T> { |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 writeSpaced('in'); | 976 writeSpaced('in'); |
977 writeExpression(node.body); | 977 writeExpression(node.body); |
978 } | 978 } |
979 | 979 |
980 defaultExpression(Expression node) { | 980 defaultExpression(Expression node) { |
981 writeWord('${node.runtimeType}'); | 981 writeWord('${node.runtimeType}'); |
982 } | 982 } |
983 | 983 |
984 visitVariableGet(VariableGet node) { | 984 visitVariableGet(VariableGet node) { |
985 writeVariableReference(node.variable); | 985 writeVariableReference(node.variable); |
| 986 if (node.promotedType != null) { |
| 987 writeSymbol('{'); |
| 988 writeNode(node.promotedType); |
| 989 writeSymbol('}'); |
| 990 state = WORD; |
| 991 } |
986 } | 992 } |
987 | 993 |
988 visitVariableSet(VariableSet node) { | 994 visitVariableSet(VariableSet node) { |
989 writeVariableReference(node.variable); | 995 writeVariableReference(node.variable); |
990 writeSpaced('='); | 996 writeSpaced('='); |
991 writeExpression(node.value); | 997 writeExpression(node.value); |
992 } | 998 } |
993 | 999 |
994 void writeInterfaceTarget(Name name, Member target) { | 1000 void writeInterfaceTarget(Name name, Member target) { |
995 if (target != null) { | 1001 if (target != null) { |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 } | 1541 } |
1536 throw 'illegal ProcedureKind: $kind'; | 1542 throw 'illegal ProcedureKind: $kind'; |
1537 } | 1543 } |
1538 | 1544 |
1539 class ExpressionPrinter { | 1545 class ExpressionPrinter { |
1540 final Printer writeer; | 1546 final Printer writeer; |
1541 final int minimumPrecedence; | 1547 final int minimumPrecedence; |
1542 | 1548 |
1543 ExpressionPrinter(this.writeer, this.minimumPrecedence); | 1549 ExpressionPrinter(this.writeer, this.minimumPrecedence); |
1544 } | 1550 } |
OLD | NEW |