| 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\") ", |
| 197 node->Name(), |
| 198 node->scope()); |
| 197 node->VisitChildren(this); | 199 node->VisitChildren(this); |
| 198 THR_Print(")"); | 200 THR_Print(")"); |
| 199 } | 201 } |
| 200 | 202 |
| 201 | 203 |
| 202 void AstPrinter::VisitAwaitMarkerNode(AwaitMarkerNode* node) { | 204 void AstPrinter::VisitAwaitMarkerNode(AwaitMarkerNode* node) { |
| 203 THR_Print("(%s (async_scope \"%p\" await_scope \"%p\"))", | 205 THR_Print("(%s (async_scope \"%p\" await_scope \"%p\"))", |
| 204 node->PrettyName(), | 206 node->Name(), |
| 205 node->async_scope(), | 207 node->async_scope(), |
| 206 node->await_scope()); | 208 node->await_scope()); |
| 207 } | 209 } |
| 208 | 210 |
| 209 | 211 |
| 210 void AstPrinter::VisitPrimaryNode(PrimaryNode* node) { | 212 void AstPrinter::VisitPrimaryNode(PrimaryNode* node) { |
| 211 THR_Print("(*****%s***** \"%s\")", | 213 THR_Print("(*****%s***** \"%s\")", |
| 212 node->PrettyName(), | 214 node->Name(), |
| 213 node->primary().ToCString()); | 215 node->primary().ToCString()); |
| 214 } | 216 } |
| 215 | 217 |
| 216 | 218 |
| 217 void AstPrinter::VisitComparisonNode(ComparisonNode* node) { | 219 void AstPrinter::VisitComparisonNode(ComparisonNode* node) { |
| 218 THR_Print("(%s %s ", node->PrettyName(), node->TokenName()); | 220 THR_Print("(%s %s ", node->Name(), node->TokenName()); |
| 219 node->VisitChildren(this); | 221 node->VisitChildren(this); |
| 220 THR_Print(")"); | 222 THR_Print(")"); |
| 221 } | 223 } |
| 222 | 224 |
| 223 | 225 |
| 224 void AstPrinter::VisitBinaryOpNode(BinaryOpNode* node) { | 226 void AstPrinter::VisitBinaryOpNode(BinaryOpNode* node) { |
| 225 THR_Print("(%s %s ", node->PrettyName(), node->TokenName()); | 227 THR_Print("(%s %s ", node->Name(), node->TokenName()); |
| 226 node->VisitChildren(this); | 228 node->VisitChildren(this); |
| 227 THR_Print(")"); | 229 THR_Print(")"); |
| 228 } | 230 } |
| 229 | 231 |
| 230 | 232 |
| 231 void AstPrinter::VisitBinaryOpWithMask32Node(BinaryOpWithMask32Node* node) { | 233 void AstPrinter::VisitBinaryOpWithMask32Node(BinaryOpWithMask32Node* node) { |
| 232 THR_Print("(%s %s ", node->PrettyName(), node->TokenName()); | 234 THR_Print("(%s %s ", node->Name(), node->TokenName()); |
| 233 node->VisitChildren(this); | 235 node->VisitChildren(this); |
| 234 THR_Print(" & \"0x%" Px64 "", node->mask32()); | 236 THR_Print(" & \"0x%" Px64 "", node->mask32()); |
| 235 THR_Print("\")"); | 237 THR_Print("\")"); |
| 236 } | 238 } |
| 237 | 239 |
| 238 | 240 |
| 239 void AstPrinter::VisitUnaryOpNode(UnaryOpNode* node) { | 241 void AstPrinter::VisitUnaryOpNode(UnaryOpNode* node) { |
| 240 THR_Print("(%s %s ", node->PrettyName(), node->TokenName()); | 242 THR_Print("(%s %s ", node->Name(), node->TokenName()); |
| 241 node->VisitChildren(this); | 243 node->VisitChildren(this); |
| 242 THR_Print(")"); | 244 THR_Print(")"); |
| 243 } | 245 } |
| 244 | 246 |
| 245 | 247 |
| 246 void AstPrinter::VisitConditionalExprNode(ConditionalExprNode* node) { | 248 void AstPrinter::VisitConditionalExprNode(ConditionalExprNode* node) { |
| 247 VisitGenericAstNode(node); | 249 VisitGenericAstNode(node); |
| 248 } | 250 } |
| 249 | 251 |
| 250 | 252 |
| 251 void AstPrinter::VisitIfNode(IfNode* node) { | 253 void AstPrinter::VisitIfNode(IfNode* node) { |
| 252 VisitGenericAstNode(node); | 254 VisitGenericAstNode(node); |
| 253 } | 255 } |
| 254 | 256 |
| 255 | 257 |
| 256 void AstPrinter::VisitCaseNode(CaseNode* node) { | 258 void AstPrinter::VisitCaseNode(CaseNode* node) { |
| 257 THR_Print("(%s (", node->PrettyName()); | 259 THR_Print("(%s (", node->Name()); |
| 258 for (int i = 0; i < node->case_expressions()->length(); i++) { | 260 for (int i = 0; i < node->case_expressions()->length(); i++) { |
| 259 node->case_expressions()->NodeAt(i)->Visit(this); | 261 node->case_expressions()->NodeAt(i)->Visit(this); |
| 260 } | 262 } |
| 261 if (node->contains_default()) { | 263 if (node->contains_default()) { |
| 262 THR_Print(" default"); | 264 THR_Print(" default"); |
| 263 } | 265 } |
| 264 THR_Print(")"); | 266 THR_Print(")"); |
| 265 node->statements()->Visit(this); | 267 node->statements()->Visit(this); |
| 266 THR_Print(")"); | 268 THR_Print(")"); |
| 267 } | 269 } |
| 268 | 270 |
| 269 | 271 |
| 270 void AstPrinter::VisitSwitchNode(SwitchNode* node) { | 272 void AstPrinter::VisitSwitchNode(SwitchNode* node) { |
| 271 VisitGenericAstNode(node); | 273 VisitGenericAstNode(node); |
| 272 } | 274 } |
| 273 | 275 |
| 274 | 276 |
| 275 void AstPrinter::VisitWhileNode(WhileNode* node) { | 277 void AstPrinter::VisitWhileNode(WhileNode* node) { |
| 276 VisitGenericAstNode(node); | 278 VisitGenericAstNode(node); |
| 277 } | 279 } |
| 278 | 280 |
| 279 | 281 |
| 280 void AstPrinter::VisitForNode(ForNode* node) { | 282 void AstPrinter::VisitForNode(ForNode* node) { |
| 281 // Complicated because the condition is optional and so we clearly want to | 283 // Complicated because the condition is optional and so we clearly want to |
| 282 // indicate the subparts. | 284 // indicate the subparts. |
| 283 THR_Print("(%s (init ", node->PrettyName()); | 285 THR_Print("(%s (init ", node->Name()); |
| 284 node->initializer()->Visit(this); | 286 node->initializer()->Visit(this); |
| 285 if (node->condition() != NULL) { | 287 if (node->condition() != NULL) { |
| 286 THR_Print(") (cond "); | 288 THR_Print(") (cond "); |
| 287 node->condition()->Visit(this); | 289 node->condition()->Visit(this); |
| 288 } | 290 } |
| 289 THR_Print(") (update "); | 291 THR_Print(") (update "); |
| 290 node->increment()->Visit(this); | 292 node->increment()->Visit(this); |
| 291 THR_Print(") "); | 293 THR_Print(") "); |
| 292 node->body()->Visit(this); | 294 node->body()->Visit(this); |
| 293 THR_Print(")"); | 295 THR_Print(")"); |
| 294 } | 296 } |
| 295 | 297 |
| 296 | 298 |
| 297 void AstPrinter::VisitDoWhileNode(DoWhileNode* node) { | 299 void AstPrinter::VisitDoWhileNode(DoWhileNode* node) { |
| 298 VisitGenericAstNode(node); | 300 VisitGenericAstNode(node); |
| 299 } | 301 } |
| 300 | 302 |
| 301 | 303 |
| 302 void AstPrinter::VisitJumpNode(JumpNode* node) { | 304 void AstPrinter::VisitJumpNode(JumpNode* node) { |
| 303 THR_Print("(%s %s %s (scope \"%p\"))", | 305 THR_Print("(%s %s %s (scope \"%p\"))", |
| 304 node->PrettyName(), | 306 node->Name(), |
| 305 node->TokenName(), | 307 node->TokenName(), |
| 306 node->label()->name().ToCString(), | 308 node->label()->name().ToCString(), |
| 307 node->label()->owner()); | 309 node->label()->owner()); |
| 308 } | 310 } |
| 309 | 311 |
| 310 | 312 |
| 311 void AstPrinter::VisitInstanceCallNode(InstanceCallNode* node) { | 313 void AstPrinter::VisitInstanceCallNode(InstanceCallNode* node) { |
| 312 THR_Print("(%s \"%s\" ", | 314 THR_Print("(%s \"%s\" ", |
| 313 node->PrettyName(), | 315 node->Name(), |
| 314 node->function_name().ToCString()); | 316 node->function_name().ToCString()); |
| 315 node->VisitChildren(this); | 317 node->VisitChildren(this); |
| 316 THR_Print(")"); | 318 THR_Print(")"); |
| 317 } | 319 } |
| 318 | 320 |
| 319 | 321 |
| 320 void AstPrinter::VisitStaticCallNode(StaticCallNode* node) { | 322 void AstPrinter::VisitStaticCallNode(StaticCallNode* node) { |
| 321 const char* function_fullname = node->function().ToFullyQualifiedCString(); | 323 const char* function_fullname = node->function().ToFullyQualifiedCString(); |
| 322 THR_Print("(%s \"%s\" ", node->PrettyName(), function_fullname); | 324 THR_Print("(%s \"%s\" ", node->Name(), function_fullname); |
| 323 node->VisitChildren(this); | 325 node->VisitChildren(this); |
| 324 THR_Print(")"); | 326 THR_Print(")"); |
| 325 } | 327 } |
| 326 | 328 |
| 327 | 329 |
| 328 void AstPrinter::VisitClosureNode(ClosureNode* node) { | 330 void AstPrinter::VisitClosureNode(ClosureNode* node) { |
| 329 const char* function_fullname = node->function().ToFullyQualifiedCString(); | 331 const char* function_fullname = node->function().ToFullyQualifiedCString(); |
| 330 THR_Print("(%s \"%s\")", node->PrettyName(), function_fullname); | 332 THR_Print("(%s \"%s\")", node->Name(), function_fullname); |
| 331 } | 333 } |
| 332 | 334 |
| 333 | 335 |
| 334 void AstPrinter::VisitClosureCallNode(ClosureCallNode* node) { | 336 void AstPrinter::VisitClosureCallNode(ClosureCallNode* node) { |
| 335 VisitGenericAstNode(node); | 337 VisitGenericAstNode(node); |
| 336 } | 338 } |
| 337 | 339 |
| 338 | 340 |
| 339 void AstPrinter::VisitConstructorCallNode(ConstructorCallNode* node) { | 341 void AstPrinter::VisitConstructorCallNode(ConstructorCallNode* node) { |
| 340 const char* kind = node->constructor().IsFactory() ? "factory " : ""; | 342 const char* kind = node->constructor().IsFactory() ? "factory " : ""; |
| 341 const char* constructor_name = node->constructor().ToFullyQualifiedCString(); | 343 const char* constructor_name = node->constructor().ToFullyQualifiedCString(); |
| 342 THR_Print("(%s %s \"%s\" ", node->PrettyName(), kind, constructor_name); | 344 THR_Print("(%s %s \"%s\" ", node->Name(), kind, constructor_name); |
| 343 node->VisitChildren(this); | 345 node->VisitChildren(this); |
| 344 THR_Print(")"); | 346 THR_Print(")"); |
| 345 } | 347 } |
| 346 | 348 |
| 347 | 349 |
| 348 void AstPrinter::VisitInstanceGetterNode(InstanceGetterNode* node) { | 350 void AstPrinter::VisitInstanceGetterNode(InstanceGetterNode* node) { |
| 349 THR_Print("(%s \"%s\" ", | 351 THR_Print("(%s \"%s\" ", |
| 350 node->PrettyName(), | 352 node->Name(), |
| 351 node->field_name().ToCString()); | 353 node->field_name().ToCString()); |
| 352 node->VisitChildren(this); | 354 node->VisitChildren(this); |
| 353 THR_Print(")"); | 355 THR_Print(")"); |
| 354 } | 356 } |
| 355 | 357 |
| 356 | 358 |
| 357 void AstPrinter::VisitInstanceSetterNode(InstanceSetterNode* node) { | 359 void AstPrinter::VisitInstanceSetterNode(InstanceSetterNode* node) { |
| 358 THR_Print("(%s \"%s\" ", | 360 THR_Print("(%s \"%s\" ", |
| 359 node->PrettyName(), | 361 node->Name(), |
| 360 node->field_name().ToCString()); | 362 node->field_name().ToCString()); |
| 361 node->VisitChildren(this); | 363 node->VisitChildren(this); |
| 362 THR_Print(")"); | 364 THR_Print(")"); |
| 363 } | 365 } |
| 364 | 366 |
| 365 | 367 |
| 366 void AstPrinter::VisitInitStaticFieldNode(InitStaticFieldNode* node) { | 368 void AstPrinter::VisitInitStaticFieldNode(InitStaticFieldNode* node) { |
| 367 THR_Print("(%s \"%s\")", node->PrettyName(), | 369 THR_Print("(%s \"%s\")", |
| 370 node->Name(), |
| 368 String::Handle(node->field().name()).ToCString()); | 371 String::Handle(node->field().name()).ToCString()); |
| 369 } | 372 } |
| 370 | 373 |
| 371 | 374 |
| 372 void AstPrinter::VisitStaticGetterNode(StaticGetterNode* node) { | 375 void AstPrinter::VisitStaticGetterNode(StaticGetterNode* node) { |
| 373 String& class_name = String::Handle(node->cls().Name()); | 376 String& class_name = String::Handle(node->cls().Name()); |
| 374 THR_Print("(%s \"%s.%s\")", | 377 THR_Print("(%s \"%s.%s\")", |
| 375 node->PrettyName(), | 378 node->Name(), |
| 376 class_name.ToCString(), | 379 class_name.ToCString(), |
| 377 node->field_name().ToCString()); | 380 node->field_name().ToCString()); |
| 378 } | 381 } |
| 379 | 382 |
| 380 | 383 |
| 381 void AstPrinter::VisitStaticSetterNode(StaticSetterNode* node) { | 384 void AstPrinter::VisitStaticSetterNode(StaticSetterNode* node) { |
| 382 String& class_name = String::Handle(node->cls().Name()); | 385 String& class_name = String::Handle(node->cls().Name()); |
| 383 THR_Print("(%s \"%s.%s\" ", | 386 THR_Print("(%s \"%s.%s\" ", |
| 384 node->PrettyName(), | 387 node->Name(), |
| 385 class_name.ToCString(), | 388 class_name.ToCString(), |
| 386 node->field_name().ToCString()); | 389 node->field_name().ToCString()); |
| 387 node->VisitChildren(this); | 390 node->VisitChildren(this); |
| 388 THR_Print(")"); | 391 THR_Print(")"); |
| 389 } | 392 } |
| 390 | 393 |
| 391 | 394 |
| 392 void AstPrinter::VisitLoadIndexedNode(LoadIndexedNode* node) { | 395 void AstPrinter::VisitLoadIndexedNode(LoadIndexedNode* node) { |
| 393 THR_Print("(%s%s ", node->PrettyName(), node->IsSuperLoad() ? " super" : ""); | 396 THR_Print("(%s%s ", node->Name(), node->IsSuperLoad() ? " super" : ""); |
| 394 node->VisitChildren(this); | 397 node->VisitChildren(this); |
| 395 THR_Print(")"); | 398 THR_Print(")"); |
| 396 } | 399 } |
| 397 | 400 |
| 398 | 401 |
| 399 void AstPrinter::VisitStoreIndexedNode(StoreIndexedNode* node) { | 402 void AstPrinter::VisitStoreIndexedNode(StoreIndexedNode* node) { |
| 400 THR_Print("(%s%s ", node->PrettyName(), node->IsSuperStore() ? " super" : ""); | 403 THR_Print("(%s%s ", node->Name(), node->IsSuperStore() ? " super" : ""); |
| 401 node->VisitChildren(this); | 404 node->VisitChildren(this); |
| 402 THR_Print(")"); | 405 THR_Print(")"); |
| 403 } | 406 } |
| 404 | 407 |
| 405 | 408 |
| 406 void AstPrinter::VisitNativeBodyNode(NativeBodyNode* node) { | 409 void AstPrinter::VisitNativeBodyNode(NativeBodyNode* node) { |
| 407 THR_Print("(%s \"%s\" (%" Pd " args))", | 410 THR_Print("(%s \"%s\" (%" Pd " args))", |
| 408 node->PrettyName(), | 411 node->Name(), |
| 409 node->native_c_function_name().ToCString(), | 412 node->native_c_function_name().ToCString(), |
| 410 NativeArguments::ParameterCountForResolution(node->function())); | 413 NativeArguments::ParameterCountForResolution(node->function())); |
| 411 } | 414 } |
| 412 | 415 |
| 413 | 416 |
| 414 void AstPrinter::VisitCatchClauseNode(CatchClauseNode* node) { | 417 void AstPrinter::VisitCatchClauseNode(CatchClauseNode* node) { |
| 415 VisitGenericAstNode(node); | 418 VisitGenericAstNode(node); |
| 416 } | 419 } |
| 417 | 420 |
| 418 | 421 |
| 419 void AstPrinter::VisitTryCatchNode(TryCatchNode* node) { | 422 void AstPrinter::VisitTryCatchNode(TryCatchNode* node) { |
| 420 THR_Print("(%s ", node->PrettyName()); | 423 THR_Print("(%s ", node->Name()); |
| 421 node->try_block()->Visit(this); | 424 node->try_block()->Visit(this); |
| 422 node->catch_block()->Visit(this); | 425 node->catch_block()->Visit(this); |
| 423 if (node->finally_block() != NULL) { | 426 if (node->finally_block() != NULL) { |
| 424 THR_Print("(finally "); | 427 THR_Print("(finally "); |
| 425 node->finally_block()->Visit(this); | 428 node->finally_block()->Visit(this); |
| 426 THR_Print(")"); | 429 THR_Print(")"); |
| 427 } | 430 } |
| 428 THR_Print(")"); | 431 THR_Print(")"); |
| 429 } | 432 } |
| 430 | 433 |
| 431 | 434 |
| 432 void AstPrinter::VisitThrowNode(ThrowNode* node) { | 435 void AstPrinter::VisitThrowNode(ThrowNode* node) { |
| 433 VisitGenericAstNode(node); | 436 VisitGenericAstNode(node); |
| 434 } | 437 } |
| 435 | 438 |
| 436 | 439 |
| 437 void AstPrinter::VisitStopNode(StopNode* node) { | 440 void AstPrinter::VisitStopNode(StopNode* node) { |
| 438 THR_Print("(%s %s)", node->PrettyName(), node->message()); | 441 THR_Print("(%s %s)", node->Name(), node->message()); |
| 439 } | 442 } |
| 440 | 443 |
| 441 | 444 |
| 442 void AstPrinter::VisitInlinedFinallyNode(InlinedFinallyNode* node) { | 445 void AstPrinter::VisitInlinedFinallyNode(InlinedFinallyNode* node) { |
| 443 VisitGenericAstNode(node); | 446 VisitGenericAstNode(node); |
| 444 } | 447 } |
| 445 | 448 |
| 446 | 449 |
| 447 void AstPrinter::PrintNode(AstNode* node) { | 450 void AstPrinter::PrintNode(AstNode* node) { |
| 448 ASSERT(node != NULL); | 451 ASSERT(node != NULL); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 const char* function_name = | 575 const char* function_name = |
| 573 parsed_function.function().ToFullyQualifiedCString(); | 576 parsed_function.function().ToFullyQualifiedCString(); |
| 574 THR_Print("Ast for function '%s' {\n", function_name); | 577 THR_Print("Ast for function '%s' {\n", function_name); |
| 575 node_sequence->Visit(&ast_printer); | 578 node_sequence->Visit(&ast_printer); |
| 576 THR_Print("}\n"); | 579 THR_Print("}\n"); |
| 577 } | 580 } |
| 578 | 581 |
| 579 } // namespace dart | 582 } // namespace dart |
| 580 | 583 |
| 581 #endif // !defined(PRODUCT) | 584 #endif // !defined(PRODUCT) |
| OLD | NEW |