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_params = function.num_optional_parameters(); | 452 const int num_opt_pos_params = function.num_optional_positional_parameters(); |
453 const int num_params = num_fixed_params + num_opt_params; | 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; |
454 // Parameters must be listed first and must all appear in the top scope. | 456 // Parameters must be listed first and must all appear in the top scope. |
455 ASSERT(num_params <= scope->num_variables()); | 457 ASSERT(num_params <= scope->num_variables()); |
456 int pos = 0; // Current position of variable in scope. | 458 int pos = 0; // Current position of variable in scope. |
457 while (pos < num_params) { | 459 while (pos < num_params) { |
458 LocalVariable* param = scope->VariableAt(pos); | 460 LocalVariable* param = scope->VariableAt(pos); |
459 ASSERT(param->owner() == scope); | 461 ASSERT(param->owner() == scope); |
460 OS::Print("(param %s%s '%s'", | 462 OS::Print("(param %s%s '%s'", |
461 param->is_final() ? "final " : "", | 463 param->is_final() ? "final " : "", |
462 String::Handle(param->type().Name()).ToCString(), | 464 String::Handle(param->type().Name()).ToCString(), |
463 param->name().ToCString()); | 465 param->name().ToCString()); |
(...skipping 26 matching lines...) Expand all Loading... |
490 ASSERT(node_sequence != NULL); | 492 ASSERT(node_sequence != NULL); |
491 AstPrinter ast_printer; | 493 AstPrinter ast_printer; |
492 const char* function_name = | 494 const char* function_name = |
493 parsed_function.function().ToFullyQualifiedCString(); | 495 parsed_function.function().ToFullyQualifiedCString(); |
494 OS::Print("Ast for function '%s' {\n", function_name); | 496 OS::Print("Ast for function '%s' {\n", function_name); |
495 node_sequence->Visit(&ast_printer); | 497 node_sequence->Visit(&ast_printer); |
496 OS::Print("}\n"); | 498 OS::Print("}\n"); |
497 } | 499 } |
498 | 500 |
499 } // namespace dart | 501 } // namespace dart |
OLD | NEW |