| 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/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/os.h" | 9 #include "vm/os.h" |
| 10 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 OS::Print(" alias"); | 410 OS::Print(" alias"); |
| 411 } | 411 } |
| 412 if (var->HasIndex()) { | 412 if (var->HasIndex()) { |
| 413 OS::Print(" @%d", var->index()); | 413 OS::Print(" @%d", var->index()); |
| 414 if (var->is_captured()) { | 414 if (var->is_captured()) { |
| 415 OS::Print(" ctx %d", var->owner()->context_level()); | 415 OS::Print(" ctx %d", var->owner()->context_level()); |
| 416 } | 416 } |
| 417 } else if (var->owner()->function_level() != 0) { | 417 } else if (var->owner()->function_level() != 0) { |
| 418 OS::Print(" lev %d", var->owner()->function_level()); | 418 OS::Print(" lev %d", var->owner()->function_level()); |
| 419 } | 419 } |
| 420 OS::Print(")"); | 420 OS::Print(" valid %d-%d)", var->token_index(), scope->end_token_index()); |
| 421 } | 421 } |
| 422 const LocalScope* child = scope->child(); | 422 const LocalScope* child = scope->child(); |
| 423 while (child != NULL) { | 423 while (child != NULL) { |
| 424 OS::Print("{scope "); | 424 OS::Print("{scope "); |
| 425 PrintLocalScope(child, 0); | 425 PrintLocalScope(child, 0); |
| 426 OS::Print("}"); | 426 OS::Print("}"); |
| 427 child = child->sibling(); | 427 child = child->sibling(); |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 | 430 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 458 const Object& default_parameter_value = Object::Handle( | 458 const Object& default_parameter_value = Object::Handle( |
| 459 default_parameter_values.At(pos - num_fixed_params)); | 459 default_parameter_values.At(pos - num_fixed_params)); |
| 460 OS::Print(" =%s", default_parameter_value.ToCString()); | 460 OS::Print(" =%s", default_parameter_value.ToCString()); |
| 461 } | 461 } |
| 462 if (param->HasIndex()) { | 462 if (param->HasIndex()) { |
| 463 OS::Print(" @%d", param->index()); | 463 OS::Print(" @%d", param->index()); |
| 464 if (param->is_captured()) { | 464 if (param->is_captured()) { |
| 465 OS::Print(" ctx %d", param->owner()->context_level()); | 465 OS::Print(" ctx %d", param->owner()->context_level()); |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 OS::Print(")"); | 468 OS::Print(" valid %d-%d)", param->token_index(), scope->end_token_index()); |
| 469 pos++; | 469 pos++; |
| 470 } | 470 } |
| 471 // Visit remaining non-parameter variables and children scopes. | 471 // Visit remaining non-parameter variables and children scopes. |
| 472 PrintLocalScope(scope, pos); | 472 PrintLocalScope(scope, pos); |
| 473 OS::Print("}\n"); | 473 OS::Print("}\n"); |
| 474 } | 474 } |
| 475 | 475 |
| 476 | 476 |
| 477 void AstPrinter::PrintFunctionNodes(const ParsedFunction& parsed_function) { | 477 void AstPrinter::PrintFunctionNodes(const ParsedFunction& parsed_function) { |
| 478 HANDLESCOPE(Isolate::Current()); | 478 HANDLESCOPE(Isolate::Current()); |
| 479 SequenceNode* node_sequence = parsed_function.node_sequence(); | 479 SequenceNode* node_sequence = parsed_function.node_sequence(); |
| 480 ASSERT(node_sequence != NULL); | 480 ASSERT(node_sequence != NULL); |
| 481 AstPrinter ast_printer; | 481 AstPrinter ast_printer; |
| 482 const char* function_name = | 482 const char* function_name = |
| 483 parsed_function.function().ToFullyQualifiedCString(); | 483 parsed_function.function().ToFullyQualifiedCString(); |
| 484 OS::Print("Ast for function '%s' {\n", function_name); | 484 OS::Print("Ast for function '%s' {\n", function_name); |
| 485 node_sequence->Visit(&ast_printer); | 485 node_sequence->Visit(&ast_printer); |
| 486 OS::Print("}\n"); | 486 OS::Print("}\n"); |
| 487 } | 487 } |
| 488 | 488 |
| 489 } // namespace dart | 489 } // namespace dart |
| OLD | NEW |