| 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 3775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3786 intptr_t Function::NumberOfImplicitParameters() const { | 3786 intptr_t Function::NumberOfImplicitParameters() const { |
| 3787 if (kind() == RawFunction::kConstructor) { | 3787 if (kind() == RawFunction::kConstructor) { |
| 3788 if (is_static()) { | 3788 if (is_static()) { |
| 3789 ASSERT(IsFactory()); | 3789 ASSERT(IsFactory()); |
| 3790 return 1; // Type arguments. | 3790 return 1; // Type arguments. |
| 3791 } else { | 3791 } else { |
| 3792 ASSERT(IsConstructor()); | 3792 ASSERT(IsConstructor()); |
| 3793 return 2; // Instance, phase. | 3793 return 2; // Instance, phase. |
| 3794 } | 3794 } |
| 3795 } | 3795 } |
| 3796 if (!is_static()) { | 3796 if (!is_static() && (kind() != RawFunction::kClosureFunction)) { |
| 3797 // Closure functions defined inside instance (i.e. non-static) functions are |
| 3798 // marked as non-static, but they do not have a receiver. |
| 3797 return 1; // Receiver. | 3799 return 1; // Receiver. |
| 3798 } | 3800 } |
| 3799 return 0; // No implicit parameters. | 3801 return 0; // No implicit parameters. |
| 3800 } | 3802 } |
| 3801 | 3803 |
| 3802 | 3804 |
| 3803 bool Function::AreValidArgumentCounts(int num_arguments, | 3805 bool Function::AreValidArgumentCounts(int num_arguments, |
| 3804 int num_named_arguments, | 3806 int num_named_arguments, |
| 3805 String* error_message) const { | 3807 String* error_message) const { |
| 3806 if (num_arguments > NumberOfParameters()) { | 3808 if (num_arguments > NumberOfParameters()) { |
| (...skipping 7037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10844 const String& str = String::Handle(pattern()); | 10846 const String& str = String::Handle(pattern()); |
| 10845 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10847 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10846 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10848 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10847 char* chars = reinterpret_cast<char*>( | 10849 char* chars = reinterpret_cast<char*>( |
| 10848 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10850 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10849 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10851 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10850 return chars; | 10852 return chars; |
| 10851 } | 10853 } |
| 10852 | 10854 |
| 10853 } // namespace dart | 10855 } // namespace dart |
| OLD | NEW |