OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #include "vm/ast_printer.h" | 5 #include "vm/ast_printer.h" |
6 | 6 |
7 #include "vm/handles.h" | 7 #include "vm/handles.h" |
8 #include "vm/log.h" | 8 #include "vm/log.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/os.h" | 10 #include "vm/os.h" |
11 #include "vm/parser.h" | 11 #include "vm/parser.h" |
12 | 12 |
13 #if !defined(PRODUCT) | 13 #if !defined(PRODUCT) |
14 | 14 |
15 namespace dart { | 15 namespace dart { |
16 | 16 |
17 AstPrinter::AstPrinter() : indent_(0) { } | 17 AstPrinter::AstPrinter() : indent_(0) { } |
18 | 18 |
19 | 19 |
20 AstPrinter::~AstPrinter() { } | 20 AstPrinter::~AstPrinter() { } |
21 | 21 |
22 | 22 |
23 void AstPrinter::VisitGenericAstNode(AstNode* node) { | 23 void AstPrinter::VisitGenericAstNode(AstNode* node) { |
24 THR_Print("(%s ", node->PrettyName()); | 24 THR_Print("(%s ", node->Name()); |
25 node->VisitChildren(this); | 25 node->VisitChildren(this); |
26 THR_Print(")"); | 26 THR_Print(")"); |
27 } | 27 } |
28 | 28 |
29 | 29 |
30 void AstPrinter::VisitSequenceNode(SequenceNode* node) { | 30 void AstPrinter::VisitSequenceNode(SequenceNode* node) { |
31 indent_++; | 31 indent_++; |
32 LocalScope* scope = node->scope(); | 32 LocalScope* scope = node->scope(); |
33 THR_Print("(%s (scope \"%p\"", node->PrettyName(), scope); | 33 THR_Print("(%s (scope \"%p\"", node->Name(), scope); |
34 if (scope != NULL) { | 34 if (scope != NULL) { |
35 THR_Print(" (%s-%s) loop %d", | 35 THR_Print(" (%s-%s) loop %d", |
36 scope->begin_token_pos().ToCString(), | 36 scope->begin_token_pos().ToCString(), |
37 scope->end_token_pos().ToCString(), | 37 scope->end_token_pos().ToCString(), |
38 scope->loop_level()); | 38 scope->loop_level()); |
39 if (scope->HasContextLevel()) { | 39 if (scope->HasContextLevel()) { |
40 THR_Print(" context %d captures %d", | 40 THR_Print(" context %d captures %d", |
41 scope->context_level(), | 41 scope->context_level(), |
42 scope->num_context_variables()); | 42 scope->num_context_variables()); |
43 } else { | 43 } else { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 case ReturnNode::kContinuationTarget: | 76 case ReturnNode::kContinuationTarget: |
77 kind = "continuation-target "; | 77 kind = "continuation-target "; |
78 break; | 78 break; |
79 case ReturnNode::kRegular: | 79 case ReturnNode::kRegular: |
80 kind = ""; | 80 kind = ""; |
81 break; | 81 break; |
82 default: | 82 default: |
83 kind = ""; | 83 kind = ""; |
84 UNREACHABLE(); | 84 UNREACHABLE(); |
85 } | 85 } |
86 THR_Print("(%s %s", node->PrettyName(), kind); | 86 THR_Print("(%s %s", node->Name(), kind); |
87 node->VisitChildren(this); | 87 node->VisitChildren(this); |
88 THR_Print(")"); | 88 THR_Print(")"); |
89 } | 89 } |
90 | 90 |
91 | 91 |
92 void AstPrinter::VisitGenericLocalNode(AstNode* node, | 92 void AstPrinter::VisitGenericLocalNode(AstNode* node, |
93 const LocalVariable& var) { | 93 const LocalVariable& var) { |
94 THR_Print("(%s %s%s \"%s\"", | 94 THR_Print("(%s %s%s \"%s\"", |
95 node->PrettyName(), | 95 node->Name(), |
96 var.is_final() ? "final " : "", | 96 var.is_final() ? "final " : "", |
97 String::Handle(var.type().Name()).ToCString(), | 97 String::Handle(var.type().Name()).ToCString(), |
98 var.name().ToCString()); | 98 var.name().ToCString()); |
99 if (var.HasIndex()) { | 99 if (var.HasIndex()) { |
100 if (var.is_captured()) { | 100 if (var.is_captured()) { |
101 THR_Print(" (context %d %d)", var.owner()->context_level(), var.index()); | 101 THR_Print(" (context %d %d)", var.owner()->context_level(), var.index()); |
102 } else { | 102 } else { |
103 THR_Print(" (stack %d)", var.index()); | 103 THR_Print(" (stack %d)", var.index()); |
104 } | 104 } |
105 } | 105 } |
106 THR_Print(" "); | 106 THR_Print(" "); |
107 node->VisitChildren(this); | 107 node->VisitChildren(this); |
108 THR_Print(")"); | 108 THR_Print(")"); |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 void AstPrinter::VisitLoadLocalNode(LoadLocalNode* node) { | 112 void AstPrinter::VisitLoadLocalNode(LoadLocalNode* node) { |
113 VisitGenericLocalNode(node, node->local()); | 113 VisitGenericLocalNode(node, node->local()); |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 void AstPrinter::VisitStoreLocalNode(StoreLocalNode* node) { | 117 void AstPrinter::VisitStoreLocalNode(StoreLocalNode* node) { |
118 VisitGenericLocalNode(node, node->local()); | 118 VisitGenericLocalNode(node, node->local()); |
119 } | 119 } |
120 | 120 |
121 | 121 |
122 void AstPrinter::VisitGenericFieldNode(AstNode* node, const Field& field) { | 122 void AstPrinter::VisitGenericFieldNode(AstNode* node, const Field& field) { |
123 THR_Print("(%s %s%s \"%s\" ", | 123 THR_Print("(%s %s%s \"%s\" ", |
124 node->PrettyName(), | 124 node->Name(), |
125 field.is_final() ? "final " : "", | 125 field.is_final() ? "final " : "", |
126 String::Handle(AbstractType::Handle(field.type()).Name()). | 126 String::Handle(AbstractType::Handle(field.type()).Name()). |
127 ToCString(), | 127 ToCString(), |
128 String::Handle(field.name()).ToCString()); | 128 String::Handle(field.name()).ToCString()); |
129 node->VisitChildren(this); | 129 node->VisitChildren(this); |
130 THR_Print(")"); | 130 THR_Print(")"); |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 void AstPrinter::VisitLoadInstanceFieldNode(LoadInstanceFieldNode* node) { | 134 void AstPrinter::VisitLoadInstanceFieldNode(LoadInstanceFieldNode* node) { |
(...skipping 26 matching lines...) Expand all Loading... |
161 } | 161 } |
162 | 162 |
163 | 163 |
164 void AstPrinter::VisitStringInterpolateNode(StringInterpolateNode* node) { | 164 void AstPrinter::VisitStringInterpolateNode(StringInterpolateNode* node) { |
165 VisitGenericAstNode(node); | 165 VisitGenericAstNode(node); |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 void AstPrinter::VisitLiteralNode(LiteralNode* node) { | 169 void AstPrinter::VisitLiteralNode(LiteralNode* node) { |
170 const Instance& literal = node->literal(); | 170 const Instance& literal = node->literal(); |
171 THR_Print("(%s \"%s\")", node->PrettyName(), literal.ToCString()); | 171 THR_Print("(%s \"%s\")", node->Name(), literal.ToCString()); |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 void AstPrinter::VisitTypeNode(TypeNode* node) { | 175 void AstPrinter::VisitTypeNode(TypeNode* node) { |
176 const AbstractType& type = node->type(); | 176 const AbstractType& type = node->type(); |
177 THR_Print("(%s \"%s\")", | 177 THR_Print("(%s \"%s\")", |
178 node->PrettyName(), | 178 node->Name(), |
179 String::Handle(type.Name()).ToCString()); | 179 String::Handle(type.Name()).ToCString()); |
180 } | 180 } |
181 | 181 |
182 | 182 |
183 void AstPrinter::VisitAssignableNode(AssignableNode* node) { | 183 void AstPrinter::VisitAssignableNode(AssignableNode* node) { |
184 const AbstractType& type = node->type(); | 184 const AbstractType& type = node->type(); |
185 const String& dst_name = node->dst_name(); | 185 const String& dst_name = node->dst_name(); |
186 THR_Print("(%s (type \"%s\") (of \"%s\") ", | 186 THR_Print("(%s (type \"%s\") (of \"%s\") ", |
187 node->PrettyName(), | 187 node->Name(), |
188 String::Handle(type.Name()).ToCString(), | 188 String::Handle(type.Name()).ToCString(), |
189 dst_name.ToCString()); | 189 dst_name.ToCString()); |
190 node->VisitChildren(this); | 190 node->VisitChildren(this); |
191 THR_Print(")"); | 191 THR_Print(")"); |
192 } | 192 } |
193 | 193 |
194 | 194 |
195 void AstPrinter::VisitAwaitNode(AwaitNode* node) { | 195 void AstPrinter::VisitAwaitNode(AwaitNode* node) { |
196 THR_Print("(*****%s***** (scope \"%p\") ", node->PrettyName(), node->scope()); | 196 THR_Print("(*****%s***** (scope \"%p\") ", node->Name(), node->scope()); |
197 node->VisitChildren(this); | 197 node->VisitChildren(this); |
198 THR_Print(")"); | 198 THR_Print(")"); |
199 } | 199 } |
200 | 200 |
201 | 201 |
202 void AstPrinter::VisitAwaitMarkerNode(AwaitMarkerNode* node) { | 202 void AstPrinter::VisitAwaitMarkerNode(AwaitMarkerNode* node) { |
203 THR_Print("(%s (async_scope \"%p\" await_scope \"%p\"))", | 203 THR_Print("(%s (async_scope \"%p\" await_scope \"%p\"))", |
204 node->PrettyName(), | 204 node->Name(), |
205 node->async_scope(), | 205 node->async_scope(), |
206 node->await_scope()); | 206 node->await_scope()); |
207 } | 207 } |
208 | 208 |
209 | 209 |
210 void AstPrinter::VisitPrimaryNode(PrimaryNode* node) { | 210 void AstPrinter::VisitPrimaryNode(PrimaryNode* node) { |
211 THR_Print("(*****%s***** \"%s\")", | 211 THR_Print("(*****%s***** \"%s\")", |
212 node->PrettyName(), | 212 node->Name(), |
213 node->primary().ToCString()); | 213 node->primary().ToCString()); |
214 } | 214 } |
215 | 215 |
216 | 216 |
217 void AstPrinter::VisitComparisonNode(ComparisonNode* node) { | 217 void AstPrinter::VisitComparisonNode(ComparisonNode* node) { |
218 THR_Print("(%s %s ", node->PrettyName(), node->TokenName()); | 218 THR_Print("(%s %s ", node->Name(), node->TokenName()); |
219 node->VisitChildren(this); | 219 node->VisitChildren(this); |
220 THR_Print(")"); | 220 THR_Print(")"); |
221 } | 221 } |
222 | 222 |
223 | 223 |
224 void AstPrinter::VisitBinaryOpNode(BinaryOpNode* node) { | 224 void AstPrinter::VisitBinaryOpNode(BinaryOpNode* node) { |
225 THR_Print("(%s %s ", node->PrettyName(), node->TokenName()); | 225 THR_Print("(%s %s ", node->Name(), node->TokenName()); |
226 node->VisitChildren(this); | 226 node->VisitChildren(this); |
227 THR_Print(")"); | 227 THR_Print(")"); |
228 } | 228 } |
229 | 229 |
230 | 230 |
231 void AstPrinter::VisitBinaryOpWithMask32Node(BinaryOpWithMask32Node* node) { | 231 void AstPrinter::VisitBinaryOpWithMask32Node(BinaryOpWithMask32Node* node) { |
232 THR_Print("(%s %s ", node->PrettyName(), node->TokenName()); | 232 THR_Print("(%s %s ", node->Name(), node->TokenName()); |
233 node->VisitChildren(this); | 233 node->VisitChildren(this); |
234 THR_Print(" & \"0x%" Px64 "", node->mask32()); | 234 THR_Print(" & \"0x%" Px64 "", node->mask32()); |
235 THR_Print("\")"); | 235 THR_Print("\")"); |
236 } | 236 } |
237 | 237 |
238 | 238 |
239 void AstPrinter::VisitUnaryOpNode(UnaryOpNode* node) { | 239 void AstPrinter::VisitUnaryOpNode(UnaryOpNode* node) { |
240 THR_Print("(%s %s ", node->PrettyName(), node->TokenName()); | 240 THR_Print("(%s %s ", node->Name(), node->TokenName()); |
241 node->VisitChildren(this); | 241 node->VisitChildren(this); |
242 THR_Print(")"); | 242 THR_Print(")"); |
243 } | 243 } |
244 | 244 |
245 | 245 |
246 void AstPrinter::VisitConditionalExprNode(ConditionalExprNode* node) { | 246 void AstPrinter::VisitConditionalExprNode(ConditionalExprNode* node) { |
247 VisitGenericAstNode(node); | 247 VisitGenericAstNode(node); |
248 } | 248 } |
249 | 249 |
250 | 250 |
251 void AstPrinter::VisitIfNode(IfNode* node) { | 251 void AstPrinter::VisitIfNode(IfNode* node) { |
252 VisitGenericAstNode(node); | 252 VisitGenericAstNode(node); |
253 } | 253 } |
254 | 254 |
255 | 255 |
256 void AstPrinter::VisitCaseNode(CaseNode* node) { | 256 void AstPrinter::VisitCaseNode(CaseNode* node) { |
257 THR_Print("(%s (", node->PrettyName()); | 257 THR_Print("(%s (", node->Name()); |
258 for (int i = 0; i < node->case_expressions()->length(); i++) { | 258 for (int i = 0; i < node->case_expressions()->length(); i++) { |
259 node->case_expressions()->NodeAt(i)->Visit(this); | 259 node->case_expressions()->NodeAt(i)->Visit(this); |
260 } | 260 } |
261 if (node->contains_default()) { | 261 if (node->contains_default()) { |
262 THR_Print(" default"); | 262 THR_Print(" default"); |
263 } | 263 } |
264 THR_Print(")"); | 264 THR_Print(")"); |
265 node->statements()->Visit(this); | 265 node->statements()->Visit(this); |
266 THR_Print(")"); | 266 THR_Print(")"); |
267 } | 267 } |
268 | 268 |
269 | 269 |
270 void AstPrinter::VisitSwitchNode(SwitchNode* node) { | 270 void AstPrinter::VisitSwitchNode(SwitchNode* node) { |
271 VisitGenericAstNode(node); | 271 VisitGenericAstNode(node); |
272 } | 272 } |
273 | 273 |
274 | 274 |
275 void AstPrinter::VisitWhileNode(WhileNode* node) { | 275 void AstPrinter::VisitWhileNode(WhileNode* node) { |
276 VisitGenericAstNode(node); | 276 VisitGenericAstNode(node); |
277 } | 277 } |
278 | 278 |
279 | 279 |
280 void AstPrinter::VisitForNode(ForNode* node) { | 280 void AstPrinter::VisitForNode(ForNode* node) { |
281 // Complicated because the condition is optional and so we clearly want to | 281 // Complicated because the condition is optional and so we clearly want to |
282 // indicate the subparts. | 282 // indicate the subparts. |
283 THR_Print("(%s (init ", node->PrettyName()); | 283 THR_Print("(%s (init ", node->Name()); |
284 node->initializer()->Visit(this); | 284 node->initializer()->Visit(this); |
285 if (node->condition() != NULL) { | 285 if (node->condition() != NULL) { |
286 THR_Print(") (cond "); | 286 THR_Print(") (cond "); |
287 node->condition()->Visit(this); | 287 node->condition()->Visit(this); |
288 } | 288 } |
289 THR_Print(") (update "); | 289 THR_Print(") (update "); |
290 node->increment()->Visit(this); | 290 node->increment()->Visit(this); |
291 THR_Print(") "); | 291 THR_Print(") "); |
292 node->body()->Visit(this); | 292 node->body()->Visit(this); |
293 THR_Print(")"); | 293 THR_Print(")"); |
294 } | 294 } |
295 | 295 |
296 | 296 |
297 void AstPrinter::VisitDoWhileNode(DoWhileNode* node) { | 297 void AstPrinter::VisitDoWhileNode(DoWhileNode* node) { |
298 VisitGenericAstNode(node); | 298 VisitGenericAstNode(node); |
299 } | 299 } |
300 | 300 |
301 | 301 |
302 void AstPrinter::VisitJumpNode(JumpNode* node) { | 302 void AstPrinter::VisitJumpNode(JumpNode* node) { |
303 THR_Print("(%s %s %s (scope \"%p\"))", | 303 THR_Print("(%s %s %s (scope \"%p\"))", |
304 node->PrettyName(), | 304 node->Name(), |
305 node->TokenName(), | 305 node->TokenName(), |
306 node->label()->name().ToCString(), | 306 node->label()->name().ToCString(), |
307 node->label()->owner()); | 307 node->label()->owner()); |
308 } | 308 } |
309 | 309 |
310 | 310 |
311 void AstPrinter::VisitInstanceCallNode(InstanceCallNode* node) { | 311 void AstPrinter::VisitInstanceCallNode(InstanceCallNode* node) { |
312 THR_Print("(%s \"%s\" ", | 312 THR_Print("(%s \"%s\" ", |
313 node->PrettyName(), | 313 node->Name(), |
314 node->function_name().ToCString()); | 314 node->function_name().ToCString()); |
315 node->VisitChildren(this); | 315 node->VisitChildren(this); |
316 THR_Print(")"); | 316 THR_Print(")"); |
317 } | 317 } |
318 | 318 |
319 | 319 |
320 void AstPrinter::VisitStaticCallNode(StaticCallNode* node) { | 320 void AstPrinter::VisitStaticCallNode(StaticCallNode* node) { |
321 const char* function_fullname = node->function().ToFullyQualifiedCString(); | 321 const char* function_fullname = node->function().ToFullyQualifiedCString(); |
322 THR_Print("(%s \"%s\" ", node->PrettyName(), function_fullname); | 322 THR_Print("(%s \"%s\" ", node->Name(), function_fullname); |
323 node->VisitChildren(this); | 323 node->VisitChildren(this); |
324 THR_Print(")"); | 324 THR_Print(")"); |
325 } | 325 } |
326 | 326 |
327 | 327 |
328 void AstPrinter::VisitClosureNode(ClosureNode* node) { | 328 void AstPrinter::VisitClosureNode(ClosureNode* node) { |
329 const char* function_fullname = node->function().ToFullyQualifiedCString(); | 329 const char* function_fullname = node->function().ToFullyQualifiedCString(); |
330 THR_Print("(%s \"%s\")", node->PrettyName(), function_fullname); | 330 THR_Print("(%s \"%s\")", node->Name(), function_fullname); |
331 } | 331 } |
332 | 332 |
333 | 333 |
334 void AstPrinter::VisitClosureCallNode(ClosureCallNode* node) { | 334 void AstPrinter::VisitClosureCallNode(ClosureCallNode* node) { |
335 VisitGenericAstNode(node); | 335 VisitGenericAstNode(node); |
336 } | 336 } |
337 | 337 |
338 | 338 |
339 void AstPrinter::VisitConstructorCallNode(ConstructorCallNode* node) { | 339 void AstPrinter::VisitConstructorCallNode(ConstructorCallNode* node) { |
340 const char* kind = node->constructor().IsFactory() ? "factory " : ""; | 340 const char* kind = node->constructor().IsFactory() ? "factory " : ""; |
341 const char* constructor_name = node->constructor().ToFullyQualifiedCString(); | 341 const char* constructor_name = node->constructor().ToFullyQualifiedCString(); |
342 THR_Print("(%s %s \"%s\" ", node->PrettyName(), kind, constructor_name); | 342 THR_Print("(%s %s \"%s\" ", node->Name(), kind, constructor_name); |
343 node->VisitChildren(this); | 343 node->VisitChildren(this); |
344 THR_Print(")"); | 344 THR_Print(")"); |
345 } | 345 } |
346 | 346 |
347 | 347 |
348 void AstPrinter::VisitInstanceGetterNode(InstanceGetterNode* node) { | 348 void AstPrinter::VisitInstanceGetterNode(InstanceGetterNode* node) { |
349 THR_Print("(%s \"%s\" ", | 349 THR_Print("(%s \"%s\" ", node->Name(), node->field_name().ToCString()); |
350 node->PrettyName(), | |
351 node->field_name().ToCString()); | |
352 node->VisitChildren(this); | 350 node->VisitChildren(this); |
353 THR_Print(")"); | 351 THR_Print(")"); |
354 } | 352 } |
355 | 353 |
356 | 354 |
357 void AstPrinter::VisitInstanceSetterNode(InstanceSetterNode* node) { | 355 void AstPrinter::VisitInstanceSetterNode(InstanceSetterNode* node) { |
358 THR_Print("(%s \"%s\" ", | 356 THR_Print("(%s \"%s\" ", node->Name(), node->field_name().ToCString()); |
359 node->PrettyName(), | |
360 node->field_name().ToCString()); | |
361 node->VisitChildren(this); | 357 node->VisitChildren(this); |
362 THR_Print(")"); | 358 THR_Print(")"); |
363 } | 359 } |
364 | 360 |
365 | 361 |
366 void AstPrinter::VisitInitStaticFieldNode(InitStaticFieldNode* node) { | 362 void AstPrinter::VisitInitStaticFieldNode(InitStaticFieldNode* node) { |
367 THR_Print("(%s \"%s\")", node->PrettyName(), | 363 THR_Print("(%s \"%s\")", |
| 364 node->Name(), |
368 String::Handle(node->field().name()).ToCString()); | 365 String::Handle(node->field().name()).ToCString()); |
369 } | 366 } |
370 | 367 |
371 | 368 |
372 void AstPrinter::VisitStaticGetterNode(StaticGetterNode* node) { | 369 void AstPrinter::VisitStaticGetterNode(StaticGetterNode* node) { |
373 String& class_name = String::Handle(node->cls().Name()); | 370 String& class_name = String::Handle(node->cls().Name()); |
374 THR_Print("(%s \"%s.%s\")", | 371 THR_Print("(%s \"%s.%s\")", |
375 node->PrettyName(), | 372 node->Name(), |
376 class_name.ToCString(), | 373 class_name.ToCString(), |
377 node->field_name().ToCString()); | 374 node->field_name().ToCString()); |
378 } | 375 } |
379 | 376 |
380 | 377 |
381 void AstPrinter::VisitStaticSetterNode(StaticSetterNode* node) { | 378 void AstPrinter::VisitStaticSetterNode(StaticSetterNode* node) { |
382 String& class_name = String::Handle(node->cls().Name()); | 379 String& class_name = String::Handle(node->cls().Name()); |
383 THR_Print("(%s \"%s.%s\" ", | 380 THR_Print("(%s \"%s.%s\" ", |
384 node->PrettyName(), | 381 node->Name(), |
385 class_name.ToCString(), | 382 class_name.ToCString(), |
386 node->field_name().ToCString()); | 383 node->field_name().ToCString()); |
387 node->VisitChildren(this); | 384 node->VisitChildren(this); |
388 THR_Print(")"); | 385 THR_Print(")"); |
389 } | 386 } |
390 | 387 |
391 | 388 |
392 void AstPrinter::VisitLoadIndexedNode(LoadIndexedNode* node) { | 389 void AstPrinter::VisitLoadIndexedNode(LoadIndexedNode* node) { |
393 THR_Print("(%s%s ", node->PrettyName(), node->IsSuperLoad() ? " super" : ""); | 390 THR_Print("(%s%s ", node->Name(), node->IsSuperLoad() ? " super" : ""); |
394 node->VisitChildren(this); | 391 node->VisitChildren(this); |
395 THR_Print(")"); | 392 THR_Print(")"); |
396 } | 393 } |
397 | 394 |
398 | 395 |
399 void AstPrinter::VisitStoreIndexedNode(StoreIndexedNode* node) { | 396 void AstPrinter::VisitStoreIndexedNode(StoreIndexedNode* node) { |
400 THR_Print("(%s%s ", node->PrettyName(), node->IsSuperStore() ? " super" : ""); | 397 THR_Print("(%s%s ", node->Name(), node->IsSuperStore() ? " super" : ""); |
401 node->VisitChildren(this); | 398 node->VisitChildren(this); |
402 THR_Print(")"); | 399 THR_Print(")"); |
403 } | 400 } |
404 | 401 |
405 | 402 |
406 void AstPrinter::VisitNativeBodyNode(NativeBodyNode* node) { | 403 void AstPrinter::VisitNativeBodyNode(NativeBodyNode* node) { |
407 THR_Print("(%s \"%s\" (%" Pd " args))", | 404 THR_Print("(%s \"%s\" (%" Pd " args))", |
408 node->PrettyName(), | 405 node->Name(), |
409 node->native_c_function_name().ToCString(), | 406 node->native_c_function_name().ToCString(), |
410 NativeArguments::ParameterCountForResolution(node->function())); | 407 NativeArguments::ParameterCountForResolution(node->function())); |
411 } | 408 } |
412 | 409 |
413 | 410 |
414 void AstPrinter::VisitCatchClauseNode(CatchClauseNode* node) { | 411 void AstPrinter::VisitCatchClauseNode(CatchClauseNode* node) { |
415 VisitGenericAstNode(node); | 412 VisitGenericAstNode(node); |
416 } | 413 } |
417 | 414 |
418 | 415 |
419 void AstPrinter::VisitTryCatchNode(TryCatchNode* node) { | 416 void AstPrinter::VisitTryCatchNode(TryCatchNode* node) { |
420 THR_Print("(%s ", node->PrettyName()); | 417 THR_Print("(%s ", node->Name()); |
421 node->try_block()->Visit(this); | 418 node->try_block()->Visit(this); |
422 node->catch_block()->Visit(this); | 419 node->catch_block()->Visit(this); |
423 if (node->finally_block() != NULL) { | 420 if (node->finally_block() != NULL) { |
424 THR_Print("(finally "); | 421 THR_Print("(finally "); |
425 node->finally_block()->Visit(this); | 422 node->finally_block()->Visit(this); |
426 THR_Print(")"); | 423 THR_Print(")"); |
427 } | 424 } |
428 THR_Print(")"); | 425 THR_Print(")"); |
429 } | 426 } |
430 | 427 |
431 | 428 |
432 void AstPrinter::VisitThrowNode(ThrowNode* node) { | 429 void AstPrinter::VisitThrowNode(ThrowNode* node) { |
433 VisitGenericAstNode(node); | 430 VisitGenericAstNode(node); |
434 } | 431 } |
435 | 432 |
436 | 433 |
437 void AstPrinter::VisitStopNode(StopNode* node) { | 434 void AstPrinter::VisitStopNode(StopNode* node) { |
438 THR_Print("(%s %s)", node->PrettyName(), node->message()); | 435 THR_Print("(%s %s)", node->Name(), node->message()); |
439 } | 436 } |
440 | 437 |
441 | 438 |
442 void AstPrinter::VisitInlinedFinallyNode(InlinedFinallyNode* node) { | 439 void AstPrinter::VisitInlinedFinallyNode(InlinedFinallyNode* node) { |
443 VisitGenericAstNode(node); | 440 VisitGenericAstNode(node); |
444 } | 441 } |
445 | 442 |
446 | 443 |
447 void AstPrinter::PrintNode(AstNode* node) { | 444 void AstPrinter::PrintNode(AstNode* node) { |
448 ASSERT(node != NULL); | 445 ASSERT(node != NULL); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 const char* function_name = | 569 const char* function_name = |
573 parsed_function.function().ToFullyQualifiedCString(); | 570 parsed_function.function().ToFullyQualifiedCString(); |
574 THR_Print("Ast for function '%s' {\n", function_name); | 571 THR_Print("Ast for function '%s' {\n", function_name); |
575 node_sequence->Visit(&ast_printer); | 572 node_sequence->Visit(&ast_printer); |
576 THR_Print("}\n"); | 573 THR_Print("}\n"); |
577 } | 574 } |
578 | 575 |
579 } // namespace dart | 576 } // namespace dart |
580 | 577 |
581 #endif // !defined(PRODUCT) | 578 #endif // !defined(PRODUCT) |
OLD | NEW |