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 | 4 |
5 part of js_ast; | 5 part of js_ast; |
6 | 6 |
7 abstract class _TypePrinterBase implements TypeRefVisitor { | 7 abstract class _TypePrinterBase implements TypeRefVisitor { |
8 void out(String s); | 8 void out(String s); |
9 void visit(Node node); | 9 void visit(Node node); |
10 | 10 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 @override | 142 @override |
143 visitIdentifier(Identifier node) { | 143 visitIdentifier(Identifier node) { |
144 //out(localNamer.getName(node)); | 144 //out(localNamer.getName(node)); |
145 out(node.name); | 145 out(node.name); |
146 } | 146 } |
147 | 147 |
148 @override | 148 @override |
149 visitAccess(PropertyAccess node) { | 149 visitAccess(PropertyAccess node) { |
150 var selector = node.selector; | 150 var selector = node.selector; |
151 assert(selector is LiteralString); | 151 if (selector is LiteralString) { |
152 if (selector is! LiteralString) { | 152 visit(node.receiver); |
| 153 out("."); |
| 154 out(selector.valueWithoutQuotes); |
| 155 } else { |
| 156 assert(false); |
153 out("?"); | 157 out("?"); |
154 return; | |
155 } | 158 } |
156 visit(node.receiver); | |
157 out("."); | |
158 out(selector.valueWithoutQuotes); | |
159 } | 159 } |
160 | 160 |
161 @override toString() => _buffer.toString(); | 161 @override toString() => _buffer.toString(); |
162 | 162 |
163 @override | 163 @override |
164 visitArrayTypeRef(ArrayTypeRef node) { | 164 visitArrayTypeRef(ArrayTypeRef node) { |
165 out("Array"); | 165 out("Array"); |
166 if (node.elementType != null) { | 166 if (node.elementType != null) { |
167 out("<"); | 167 out("<"); |
168 visit(node.elementType); | 168 visit(node.elementType); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 outSeparated(", ", node.paramTypes.values); | 217 outSeparated(", ", node.paramTypes.values); |
218 } | 218 } |
219 out(')'); | 219 out(')'); |
220 if (node.returnType != null) { | 220 if (node.returnType != null) { |
221 out(":"); | 221 out(":"); |
222 visit(node.returnType); | 222 visit(node.returnType); |
223 } | 223 } |
224 } | 224 } |
225 } | 225 } |
226 } | 226 } |
OLD | NEW |