| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 ASSERT(scope != NULL); | 442 ASSERT(scope != NULL); |
| 443 const char* function_name = function.ToFullyQualifiedCString(); | 443 const char* function_name = function.ToFullyQualifiedCString(); |
| 444 OS::Print("Scope for function '%s' {scope %p ", function_name, scope); | 444 OS::Print("Scope for function '%s' {scope %p ", function_name, scope); |
| 445 if (scope->HasContextLevel()) { | 445 if (scope->HasContextLevel()) { |
| 446 OS::Print("ctx %d numctxvar %d ", | 446 OS::Print("ctx %d numctxvar %d ", |
| 447 scope->context_level(), | 447 scope->context_level(), |
| 448 scope->num_context_variables()); | 448 scope->num_context_variables()); |
| 449 } | 449 } |
| 450 OS::Print("llev %d ", scope->loop_level()); | 450 OS::Print("llev %d ", scope->loop_level()); |
| 451 const int num_fixed_params = function.num_fixed_parameters(); | 451 const int num_fixed_params = function.num_fixed_parameters(); |
| 452 const int num_opt_pos_params = function.num_optional_positional_parameters(); | 452 const int num_params = num_fixed_params + function.NumOptionalParameters(); |
| 453 const int num_opt_named_params = function.num_optional_named_parameters(); | |
| 454 const int num_params = | |
| 455 num_fixed_params + num_opt_pos_params + num_opt_named_params; | |
| 456 // Parameters must be listed first and must all appear in the top scope. | 453 // Parameters must be listed first and must all appear in the top scope. |
| 457 ASSERT(num_params <= scope->num_variables()); | 454 ASSERT(num_params <= scope->num_variables()); |
| 458 int pos = 0; // Current position of variable in scope. | 455 int pos = 0; // Current position of variable in scope. |
| 459 while (pos < num_params) { | 456 while (pos < num_params) { |
| 460 LocalVariable* param = scope->VariableAt(pos); | 457 LocalVariable* param = scope->VariableAt(pos); |
| 461 ASSERT(param->owner() == scope); | 458 ASSERT(param->owner() == scope); |
| 462 OS::Print("(param %s%s '%s'", | 459 OS::Print("(param %s%s '%s'", |
| 463 param->is_final() ? "final " : "", | 460 param->is_final() ? "final " : "", |
| 464 String::Handle(param->type().Name()).ToCString(), | 461 String::Handle(param->type().Name()).ToCString(), |
| 465 param->name().ToCString()); | 462 param->name().ToCString()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 492 ASSERT(node_sequence != NULL); | 489 ASSERT(node_sequence != NULL); |
| 493 AstPrinter ast_printer; | 490 AstPrinter ast_printer; |
| 494 const char* function_name = | 491 const char* function_name = |
| 495 parsed_function.function().ToFullyQualifiedCString(); | 492 parsed_function.function().ToFullyQualifiedCString(); |
| 496 OS::Print("Ast for function '%s' {\n", function_name); | 493 OS::Print("Ast for function '%s' {\n", function_name); |
| 497 node_sequence->Visit(&ast_printer); | 494 node_sequence->Visit(&ast_printer); |
| 498 OS::Print("}\n"); | 495 OS::Print("}\n"); |
| 499 } | 496 } |
| 500 | 497 |
| 501 } // namespace dart | 498 } // namespace dart |
| OLD | NEW |