| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #include "vm/scopes.h" | 30 #include "vm/scopes.h" |
| 31 #include "vm/stack_frame.h" | 31 #include "vm/stack_frame.h" |
| 32 #include "vm/symbols.h" | 32 #include "vm/symbols.h" |
| 33 #include "vm/timer.h" | 33 #include "vm/timer.h" |
| 34 #include "vm/unicode.h" | 34 #include "vm/unicode.h" |
| 35 | 35 |
| 36 namespace dart { | 36 namespace dart { |
| 37 | 37 |
| 38 DEFINE_FLAG(bool, generate_gdb_symbols, false, | 38 DEFINE_FLAG(bool, generate_gdb_symbols, false, |
| 39 "Generate symbols of generated dart functions for debugging with GDB"); | 39 "Generate symbols of generated dart functions for debugging with GDB"); |
| 40 DEFINE_FLAG(bool, reject_named_argument_as_positional, true, | |
| 41 "Enforce new rules for optional parameters and disallow passing of named " | |
| 42 "arguments to optional positional formal parameters"); | |
| 43 DEFINE_FLAG(bool, show_internal_names, false, | 40 DEFINE_FLAG(bool, show_internal_names, false, |
| 44 "Show names of internal classes (e.g. \"OneByteString\") in error messages " | 41 "Show names of internal classes (e.g. \"OneByteString\") in error messages " |
| 45 "instead of showing the corresponding interface names (e.g. \"String\")"); | 42 "instead of showing the corresponding interface names (e.g. \"String\")"); |
| 46 DEFINE_FLAG(bool, trace_disabling_optimized_code, false, | 43 DEFINE_FLAG(bool, trace_disabling_optimized_code, false, |
| 47 "Trace disabling optimized code."); | 44 "Trace disabling optimized code."); |
| 48 DECLARE_FLAG(bool, trace_compiler); | 45 DECLARE_FLAG(bool, trace_compiler); |
| 49 DECLARE_FLAG(bool, eliminate_type_checks); | 46 DECLARE_FLAG(bool, eliminate_type_checks); |
| 50 DECLARE_FLAG(bool, enable_type_checks); | 47 DECLARE_FLAG(bool, enable_type_checks); |
| 51 | 48 |
| 52 static const char* kGetterPrefix = "get:"; | 49 static const char* kGetterPrefix = "get:"; |
| (...skipping 3362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3415 // marked as non-static, but they do not have a receiver. | 3412 // marked as non-static, but they do not have a receiver. |
| 3416 return 1; // Receiver. | 3413 return 1; // Receiver. |
| 3417 } | 3414 } |
| 3418 return 0; // No implicit parameters. | 3415 return 0; // No implicit parameters. |
| 3419 } | 3416 } |
| 3420 | 3417 |
| 3421 | 3418 |
| 3422 bool Function::AreValidArgumentCounts(int num_arguments, | 3419 bool Function::AreValidArgumentCounts(int num_arguments, |
| 3423 int num_named_arguments, | 3420 int num_named_arguments, |
| 3424 String* error_message) const { | 3421 String* error_message) const { |
| 3425 if (FLAG_reject_named_argument_as_positional) { | 3422 if (num_named_arguments > NumOptionalNamedParameters()) { |
| 3426 if (num_named_arguments > NumOptionalNamedParameters()) { | |
| 3427 if (error_message != NULL) { | |
| 3428 const intptr_t kMessageBufferSize = 64; | |
| 3429 char message_buffer[kMessageBufferSize]; | |
| 3430 OS::SNPrint(message_buffer, | |
| 3431 kMessageBufferSize, | |
| 3432 "%d named passed, at most %"Pd" expected", | |
| 3433 num_named_arguments, | |
| 3434 NumOptionalNamedParameters()); | |
| 3435 *error_message = String::New(message_buffer); | |
| 3436 } | |
| 3437 return false; // Too many named arguments. | |
| 3438 } | |
| 3439 const int num_pos_args = num_arguments - num_named_arguments; | |
| 3440 const int num_opt_pos_params = NumOptionalPositionalParameters(); | |
| 3441 const int num_pos_params = num_fixed_parameters() + num_opt_pos_params; | |
| 3442 if (num_pos_args > num_pos_params) { | |
| 3443 if (error_message != NULL) { | |
| 3444 const intptr_t kMessageBufferSize = 64; | |
| 3445 char message_buffer[kMessageBufferSize]; | |
| 3446 // Hide implicit parameters to the user. | |
| 3447 const intptr_t num_hidden_params = NumImplicitParameters(); | |
| 3448 OS::SNPrint(message_buffer, | |
| 3449 kMessageBufferSize, | |
| 3450 "%"Pd"%s passed, %s%"Pd" expected", | |
| 3451 num_pos_args - num_hidden_params, | |
| 3452 num_opt_pos_params > 0 ? " positional" : "", | |
| 3453 num_opt_pos_params > 0 ? "at most " : "", | |
| 3454 num_pos_params - num_hidden_params); | |
| 3455 *error_message = String::New(message_buffer); | |
| 3456 } | |
| 3457 return false; // Too many fixed and/or positional arguments. | |
| 3458 } | |
| 3459 if (num_pos_args < num_fixed_parameters()) { | |
| 3460 if (error_message != NULL) { | |
| 3461 const intptr_t kMessageBufferSize = 64; | |
| 3462 char message_buffer[kMessageBufferSize]; | |
| 3463 // Hide implicit parameters to the user. | |
| 3464 const intptr_t num_hidden_params = NumImplicitParameters(); | |
| 3465 OS::SNPrint(message_buffer, | |
| 3466 kMessageBufferSize, | |
| 3467 "%"Pd"%s passed, %s%"Pd" expected", | |
| 3468 num_pos_args - num_hidden_params, | |
| 3469 num_opt_pos_params > 0 ? " positional" : "", | |
| 3470 num_opt_pos_params > 0 ? "at least " : "", | |
| 3471 num_fixed_parameters() - num_hidden_params); | |
| 3472 *error_message = String::New(message_buffer); | |
| 3473 } | |
| 3474 return false; // Too few fixed and/or positional arguments. | |
| 3475 } | |
| 3476 return true; | |
| 3477 } | |
| 3478 | |
| 3479 // TODO(regis): Remove the following code once the flag is removed. | |
| 3480 | |
| 3481 if (num_arguments > NumParameters()) { | |
| 3482 if (error_message != NULL) { | 3423 if (error_message != NULL) { |
| 3483 const intptr_t kMessageBufferSize = 64; | 3424 const intptr_t kMessageBufferSize = 64; |
| 3484 char message_buffer[kMessageBufferSize]; | 3425 char message_buffer[kMessageBufferSize]; |
| 3426 OS::SNPrint(message_buffer, |
| 3427 kMessageBufferSize, |
| 3428 "%d named passed, at most %"Pd" expected", |
| 3429 num_named_arguments, |
| 3430 NumOptionalNamedParameters()); |
| 3431 *error_message = String::New(message_buffer); |
| 3432 } |
| 3433 return false; // Too many named arguments. |
| 3434 } |
| 3435 const int num_pos_args = num_arguments - num_named_arguments; |
| 3436 const int num_opt_pos_params = NumOptionalPositionalParameters(); |
| 3437 const int num_pos_params = num_fixed_parameters() + num_opt_pos_params; |
| 3438 if (num_pos_args > num_pos_params) { |
| 3439 if (error_message != NULL) { |
| 3440 const intptr_t kMessageBufferSize = 64; |
| 3441 char message_buffer[kMessageBufferSize]; |
| 3485 // Hide implicit parameters to the user. | 3442 // Hide implicit parameters to the user. |
| 3486 const intptr_t num_hidden_params = NumImplicitParameters(); | 3443 const intptr_t num_hidden_params = NumImplicitParameters(); |
| 3487 OS::SNPrint(message_buffer, | 3444 OS::SNPrint(message_buffer, |
| 3488 kMessageBufferSize, | 3445 kMessageBufferSize, |
| 3489 "%"Pd" passed, %s%"Pd" expected", | 3446 "%"Pd"%s passed, %s%"Pd" expected", |
| 3490 num_arguments - num_hidden_params, | 3447 num_pos_args - num_hidden_params, |
| 3491 HasOptionalParameters() ? "at most " : "", | 3448 num_opt_pos_params > 0 ? " positional" : "", |
| 3492 NumParameters() - num_hidden_params); | 3449 num_opt_pos_params > 0 ? "at most " : "", |
| 3450 num_pos_params - num_hidden_params); |
| 3493 *error_message = String::New(message_buffer); | 3451 *error_message = String::New(message_buffer); |
| 3494 } | 3452 } |
| 3495 return false; // Too many arguments. | 3453 return false; // Too many fixed and/or positional arguments. |
| 3496 } | 3454 } |
| 3497 const int num_positional_args = num_arguments - num_named_arguments; | 3455 if (num_pos_args < num_fixed_parameters()) { |
| 3498 if (num_positional_args < num_fixed_parameters()) { | |
| 3499 if (error_message != NULL) { | 3456 if (error_message != NULL) { |
| 3500 const intptr_t kMessageBufferSize = 64; | 3457 const intptr_t kMessageBufferSize = 64; |
| 3501 char message_buffer[kMessageBufferSize]; | 3458 char message_buffer[kMessageBufferSize]; |
| 3502 // Hide implicit parameters to the user. | 3459 // Hide implicit parameters to the user. |
| 3503 const intptr_t num_hidden_params = NumImplicitParameters(); | 3460 const intptr_t num_hidden_params = NumImplicitParameters(); |
| 3504 OS::SNPrint(message_buffer, | 3461 OS::SNPrint(message_buffer, |
| 3505 kMessageBufferSize, | 3462 kMessageBufferSize, |
| 3506 "%"Pd" %spassed, %"Pd" expected", | 3463 "%"Pd"%s passed, %s%"Pd" expected", |
| 3507 num_positional_args - num_hidden_params, | 3464 num_pos_args - num_hidden_params, |
| 3508 HasOptionalParameters() ? "positional " : "", | 3465 num_opt_pos_params > 0 ? " positional" : "", |
| 3466 num_opt_pos_params > 0 ? "at least " : "", |
| 3509 num_fixed_parameters() - num_hidden_params); | 3467 num_fixed_parameters() - num_hidden_params); |
| 3510 *error_message = String::New(message_buffer); | 3468 *error_message = String::New(message_buffer); |
| 3511 } | 3469 } |
| 3512 return false; // Too few arguments. | 3470 return false; // Too few fixed and/or positional arguments. |
| 3513 } | 3471 } |
| 3514 return true; | 3472 return true; |
| 3515 } | 3473 } |
| 3516 | 3474 |
| 3517 | 3475 |
| 3518 bool Function::AreValidArguments(int num_arguments, | 3476 bool Function::AreValidArguments(int num_arguments, |
| 3519 const Array& argument_names, | 3477 const Array& argument_names, |
| 3520 String* error_message) const { | 3478 String* error_message) const { |
| 3521 const int num_named_arguments = | 3479 const int num_named_arguments = |
| 3522 argument_names.IsNull() ? 0 : argument_names.Length(); | 3480 argument_names.IsNull() ? 0 : argument_names.Length(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3618 const intptr_t num_opt_named_params = NumOptionalNamedParameters(); | 3576 const intptr_t num_opt_named_params = NumOptionalNamedParameters(); |
| 3619 const intptr_t other_num_fixed_params = other.num_fixed_parameters(); | 3577 const intptr_t other_num_fixed_params = other.num_fixed_parameters(); |
| 3620 const intptr_t other_num_opt_pos_params = | 3578 const intptr_t other_num_opt_pos_params = |
| 3621 other.NumOptionalPositionalParameters(); | 3579 other.NumOptionalPositionalParameters(); |
| 3622 const intptr_t other_num_opt_named_params = | 3580 const intptr_t other_num_opt_named_params = |
| 3623 other.NumOptionalNamedParameters(); | 3581 other.NumOptionalNamedParameters(); |
| 3624 // A generative constructor may be compared to a redirecting factory and be | 3582 // A generative constructor may be compared to a redirecting factory and be |
| 3625 // compatible although it has an additional phase parameter. | 3583 // compatible although it has an additional phase parameter. |
| 3626 const intptr_t num_ignored_params = | 3584 const intptr_t num_ignored_params = |
| 3627 (other.IsRedirectingFactory() && IsConstructor()) ? 1 : 0; | 3585 (other.IsRedirectingFactory() && IsConstructor()) ? 1 : 0; |
| 3628 if (FLAG_reject_named_argument_as_positional) { | 3586 // The default values of optional parameters can differ. |
| 3629 // The default values of optional parameters can differ. | 3587 if (((num_fixed_params - num_ignored_params) != other_num_fixed_params) || |
| 3630 if (((num_fixed_params - num_ignored_params) != other_num_fixed_params) || | 3588 (num_opt_pos_params < other_num_opt_pos_params) || |
| 3631 (num_opt_pos_params < other_num_opt_pos_params) || | 3589 (num_opt_named_params < other_num_opt_named_params)) { |
| 3632 (num_opt_named_params < other_num_opt_named_params)) { | 3590 return false; |
| 3633 return false; | 3591 } |
| 3634 } | 3592 if (other_num_opt_named_params == 0) { |
| 3635 if (other_num_opt_named_params == 0) { | 3593 return true; |
| 3636 return true; | 3594 } |
| 3637 } | 3595 // Check that for each optional named parameter of the other function there |
| 3638 // Check that for each optional named parameter of the other function there | 3596 // exists an optional named parameter of this function with an identical |
| 3639 // exists an optional named parameter of this function with an identical | 3597 // name. |
| 3640 // name. | 3598 // Note that SetParameterNameAt() guarantees that names are symbols, so we |
| 3641 // Note that SetParameterNameAt() guarantees that names are symbols, so we | 3599 // can compare their raw pointers. |
| 3642 // can compare their raw pointers. | 3600 const int num_params = num_fixed_params + num_opt_named_params; |
| 3643 const int num_params = num_fixed_params + num_opt_named_params; | 3601 const int other_num_params = |
| 3644 const int other_num_params = | 3602 other_num_fixed_params + other_num_opt_named_params; |
| 3645 other_num_fixed_params + other_num_opt_named_params; | 3603 bool found_param_name; |
| 3646 bool found_param_name; | 3604 String& other_param_name = String::Handle(); |
| 3647 String& other_param_name = String::Handle(); | 3605 for (intptr_t i = other_num_fixed_params; i < other_num_params; i++) { |
| 3648 for (intptr_t i = other_num_fixed_params; i < other_num_params; i++) { | 3606 other_param_name = other.ParameterNameAt(i); |
| 3649 other_param_name = other.ParameterNameAt(i); | 3607 found_param_name = false; |
| 3650 found_param_name = false; | 3608 for (intptr_t j = num_fixed_params; j < num_params; j++) { |
| 3651 for (intptr_t j = num_fixed_params; j < num_params; j++) { | 3609 if (ParameterNameAt(j) == other_param_name.raw()) { |
| 3652 if (ParameterNameAt(j) == other_param_name.raw()) { | 3610 found_param_name = true; |
| 3653 found_param_name = true; | 3611 break; |
| 3654 break; | |
| 3655 } | |
| 3656 } | |
| 3657 if (!found_param_name) { | |
| 3658 return false; | |
| 3659 } | 3612 } |
| 3660 } | 3613 } |
| 3661 return true; | 3614 if (!found_param_name) { |
| 3662 } | |
| 3663 | |
| 3664 // TODO(regis): Remove the following code once the flag is removed. | |
| 3665 | |
| 3666 // The default values of optional parameters can differ. | |
| 3667 const intptr_t num_opt_params = num_opt_pos_params + num_opt_named_params; | |
| 3668 const intptr_t other_num_opt_params = | |
| 3669 other_num_opt_pos_params + other_num_opt_named_params; | |
| 3670 if (((num_fixed_params - num_ignored_params) != other_num_fixed_params) || | |
| 3671 (num_opt_params < other_num_opt_params)) { | |
| 3672 return false; | |
| 3673 } | |
| 3674 // Check that for each optional named parameter of the other function there is | |
| 3675 // a corresponding optional named parameter of this function with an identical | |
| 3676 // name at the same position. | |
| 3677 // Note that SetParameterNameAt() guarantees that names are symbols, so we can | |
| 3678 // compare their raw pointers. | |
| 3679 const int other_num_params = other_num_fixed_params + other_num_opt_params; | |
| 3680 for (intptr_t i = other_num_fixed_params; i < other_num_params; i++) { | |
| 3681 const String& other_param_name = String::Handle(other.ParameterNameAt(i)); | |
| 3682 ASSERT(other_param_name.IsSymbol()); | |
| 3683 ASSERT(String::Handle(ParameterNameAt(i)).IsSymbol()); | |
| 3684 if (ParameterNameAt(i) != other_param_name.raw()) { | |
| 3685 return false; | 3615 return false; |
| 3686 } | 3616 } |
| 3687 } | 3617 } |
| 3688 return true; | 3618 return true; |
| 3689 } | 3619 } |
| 3690 | 3620 |
| 3691 | 3621 |
| 3692 // If test_kind == kIsSubtypeOf, checks if the type of the specified parameter | 3622 // If test_kind == kIsSubtypeOf, checks if the type of the specified parameter |
| 3693 // of this function is a subtype or a supertype of the type of the specified | 3623 // of this function is a subtype or a supertype of the type of the specified |
| 3694 // parameter of the other function. | 3624 // parameter of the other function. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3772 !other_res_type.IsSubtypeOf(res_type, malformed_error)) { | 3702 !other_res_type.IsSubtypeOf(res_type, malformed_error)) { |
| 3773 return false; | 3703 return false; |
| 3774 } | 3704 } |
| 3775 } else { | 3705 } else { |
| 3776 ASSERT(test_kind == kIsMoreSpecificThan); | 3706 ASSERT(test_kind == kIsMoreSpecificThan); |
| 3777 if (!res_type.IsMoreSpecificThan(other_res_type, malformed_error)) { | 3707 if (!res_type.IsMoreSpecificThan(other_res_type, malformed_error)) { |
| 3778 return false; | 3708 return false; |
| 3779 } | 3709 } |
| 3780 } | 3710 } |
| 3781 } | 3711 } |
| 3782 if (FLAG_reject_named_argument_as_positional) { | 3712 // Check the types of fixed and optional positional parameters. |
| 3783 // Check the types of fixed and optional positional parameters. | 3713 for (intptr_t i = 0; i < num_fixed_params + other_num_opt_pos_params; i++) { |
| 3784 for (intptr_t i = 0; i < num_fixed_params + other_num_opt_pos_params; i++) { | |
| 3785 if (!TestParameterType(test_kind, | |
| 3786 i, i, type_arguments, other, other_type_arguments, | |
| 3787 malformed_error)) { | |
| 3788 return false; | |
| 3789 } | |
| 3790 } | |
| 3791 // Check the names and types of optional named parameters. | |
| 3792 if (other_num_opt_named_params == 0) { | |
| 3793 return true; | |
| 3794 } | |
| 3795 // Check that for each optional named parameter of type T of the other | |
| 3796 // function type, there exists an optional named parameter of this function | |
| 3797 // type with an identical name and with a type S that is a either a subtype | |
| 3798 // or supertype of T (if test_kind == kIsSubtypeOf) or that is more specific | |
| 3799 // than T (if test_kind == kIsMoreSpecificThan). | |
| 3800 // Note that SetParameterNameAt() guarantees that names are symbols, so we | |
| 3801 // can compare their raw pointers. | |
| 3802 const int num_params = num_fixed_params + num_opt_named_params; | |
| 3803 const int other_num_params = | |
| 3804 other_num_fixed_params + other_num_opt_named_params; | |
| 3805 bool found_param_name; | |
| 3806 String& other_param_name = String::Handle(); | |
| 3807 for (intptr_t i = other_num_fixed_params; i < other_num_params; i++) { | |
| 3808 other_param_name = other.ParameterNameAt(i); | |
| 3809 ASSERT(other_param_name.IsSymbol()); | |
| 3810 found_param_name = false; | |
| 3811 for (intptr_t j = num_fixed_params; j < num_params; j++) { | |
| 3812 ASSERT(String::Handle(ParameterNameAt(j)).IsSymbol()); | |
| 3813 if (ParameterNameAt(j) == other_param_name.raw()) { | |
| 3814 found_param_name = true; | |
| 3815 if (!TestParameterType(test_kind, | |
| 3816 j, i, | |
| 3817 type_arguments, other, other_type_arguments, | |
| 3818 malformed_error)) { | |
| 3819 return false; | |
| 3820 } | |
| 3821 break; | |
| 3822 } | |
| 3823 } | |
| 3824 if (!found_param_name) { | |
| 3825 return false; | |
| 3826 } | |
| 3827 } | |
| 3828 } | |
| 3829 | |
| 3830 // TODO(regis): Remove the following code once the flag is removed. | |
| 3831 | |
| 3832 // Check the types of fixed parameters. | |
| 3833 for (intptr_t i = 0; i < num_fixed_params; i++) { | |
| 3834 if (!TestParameterType(test_kind, | 3714 if (!TestParameterType(test_kind, |
| 3835 i, i, type_arguments, other, other_type_arguments, | 3715 i, i, type_arguments, other, other_type_arguments, |
| 3836 malformed_error)) { | 3716 malformed_error)) { |
| 3837 return false; | 3717 return false; |
| 3838 } | 3718 } |
| 3839 } | 3719 } |
| 3840 // Check the names and types of optional parameters. | 3720 // Check the names and types of optional named parameters. |
| 3721 if (other_num_opt_named_params == 0) { |
| 3722 return true; |
| 3723 } |
| 3841 // Check that for each optional named parameter of type T of the other | 3724 // Check that for each optional named parameter of type T of the other |
| 3842 // function type, there is a corresponding optional named parameter of this | 3725 // function type, there exists an optional named parameter of this function |
| 3843 // function at the same position with an identical name and with a type S | 3726 // type with an identical name and with a type S that is a either a subtype |
| 3844 // that is a either a subtype or supertype of T (if test_kind == kIsSubtypeOf) | 3727 // or supertype of T (if test_kind == kIsSubtypeOf) or that is more specific |
| 3845 // or that is more specific than T (if test_kind == kIsMoreSpecificThan). | 3728 // than T (if test_kind == kIsMoreSpecificThan). |
| 3846 // Note that SetParameterNameAt() guarantees that names are symbols, so we | 3729 // Note that SetParameterNameAt() guarantees that names are symbols, so we |
| 3847 // can compare their raw pointers. | 3730 // can compare their raw pointers. |
| 3848 const intptr_t other_num_params = other_num_fixed_params + | 3731 const int num_params = num_fixed_params + num_opt_named_params; |
| 3849 other_num_opt_pos_params + other_num_opt_named_params; | 3732 const int other_num_params = |
| 3733 other_num_fixed_params + other_num_opt_named_params; |
| 3734 bool found_param_name; |
| 3850 String& other_param_name = String::Handle(); | 3735 String& other_param_name = String::Handle(); |
| 3851 for (intptr_t i = other_num_fixed_params; i < other_num_params; i++) { | 3736 for (intptr_t i = other_num_fixed_params; i < other_num_params; i++) { |
| 3852 other_param_name = other.ParameterNameAt(i); | 3737 other_param_name = other.ParameterNameAt(i); |
| 3853 ASSERT(other_param_name.IsSymbol()); | 3738 ASSERT(other_param_name.IsSymbol()); |
| 3854 ASSERT(String::Handle(ParameterNameAt(i)).IsSymbol()); | 3739 found_param_name = false; |
| 3855 if ((ParameterNameAt(i) != other_param_name.raw()) || | 3740 for (intptr_t j = num_fixed_params; j < num_params; j++) { |
| 3856 !TestParameterType(test_kind, | 3741 ASSERT(String::Handle(ParameterNameAt(j)).IsSymbol()); |
| 3857 i, i, type_arguments, other, other_type_arguments, | 3742 if (ParameterNameAt(j) == other_param_name.raw()) { |
| 3858 malformed_error)) { | 3743 found_param_name = true; |
| 3744 if (!TestParameterType(test_kind, |
| 3745 j, i, |
| 3746 type_arguments, other, other_type_arguments, |
| 3747 malformed_error)) { |
| 3748 return false; |
| 3749 } |
| 3750 break; |
| 3751 } |
| 3752 } |
| 3753 if (!found_param_name) { |
| 3859 return false; | 3754 return false; |
| 3860 } | 3755 } |
| 3861 } | 3756 } |
| 3862 return true; | 3757 return true; |
| 3863 } | 3758 } |
| 3864 | 3759 |
| 3865 | 3760 |
| 3866 bool Function::IsImplicitClosureFunction() const { | 3761 bool Function::IsImplicitClosureFunction() const { |
| 3867 if (!IsClosureFunction()) { | 3762 if (!IsClosureFunction()) { |
| 3868 return false; | 3763 return false; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4087 } | 3982 } |
| 4088 if (num_opt_params > 0) { | 3983 if (num_opt_params > 0) { |
| 4089 if (num_opt_pos_params > 0) { | 3984 if (num_opt_pos_params > 0) { |
| 4090 pieces.Add(kLBracket); | 3985 pieces.Add(kLBracket); |
| 4091 } else { | 3986 } else { |
| 4092 pieces.Add(kLBrace); | 3987 pieces.Add(kLBrace); |
| 4093 } | 3988 } |
| 4094 for (intptr_t i = num_fixed_params; i < num_params; i++) { | 3989 for (intptr_t i = num_fixed_params; i < num_params; i++) { |
| 4095 // The parameter name of an optional positional parameter does not need | 3990 // The parameter name of an optional positional parameter does not need |
| 4096 // to be part of the signature, since it is not used. | 3991 // to be part of the signature, since it is not used. |
| 4097 if (!FLAG_reject_named_argument_as_positional || | 3992 if (num_opt_named_params > 0) { |
| 4098 (num_opt_named_params > 0)) { | |
| 4099 name = ParameterNameAt(i); | 3993 name = ParameterNameAt(i); |
| 4100 pieces.Add(name); | 3994 pieces.Add(name); |
| 4101 pieces.Add(kColonSpace); | 3995 pieces.Add(kColonSpace); |
| 4102 } | 3996 } |
| 4103 param_type = ParameterTypeAt(i); | 3997 param_type = ParameterTypeAt(i); |
| 4104 if (instantiate && !param_type.IsInstantiated()) { | 3998 if (instantiate && !param_type.IsInstantiated()) { |
| 4105 param_type = param_type.InstantiateFrom(instantiator); | 3999 param_type = param_type.InstantiateFrom(instantiator); |
| 4106 } | 4000 } |
| 4107 ASSERT(!param_type.IsNull()); | 4001 ASSERT(!param_type.IsNull()); |
| 4108 name = param_type.BuildName(name_visibility); | 4002 name = param_type.BuildName(name_visibility); |
| (...skipping 8152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12261 } | 12155 } |
| 12262 return result.raw(); | 12156 return result.raw(); |
| 12263 } | 12157 } |
| 12264 | 12158 |
| 12265 | 12159 |
| 12266 const char* WeakProperty::ToCString() const { | 12160 const char* WeakProperty::ToCString() const { |
| 12267 return "_WeakProperty"; | 12161 return "_WeakProperty"; |
| 12268 } | 12162 } |
| 12269 | 12163 |
| 12270 } // namespace dart | 12164 } // namespace dart |
| OLD | NEW |