Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: runtime/vm/object.cc

Issue 10829041: Fix Function::NumberOfImplicitParameters() for closure functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 (kind() == RawFunction::kClosureFunction) {
3797 return 0;
3798 }
3796 if (!is_static()) { 3799 if (!is_static()) {
Ivan Posva 2012/07/26 18:30:55 How about if (!is_static() && (kind() != RawFunct
regis 2012/07/26 18:43:19 Done.
3797 return 1; // Receiver. 3800 return 1; // Receiver.
3798 } 3801 }
3799 return 0; // No implicit parameters. 3802 return 0; // No implicit parameters.
3800 } 3803 }
3801 3804
3802 3805
3803 bool Function::AreValidArgumentCounts(int num_arguments, 3806 bool Function::AreValidArgumentCounts(int num_arguments,
3804 int num_named_arguments, 3807 int num_named_arguments,
3805 String* error_message) const { 3808 String* error_message) const {
3806 if (num_arguments > NumberOfParameters()) { 3809 if (num_arguments > NumberOfParameters()) {
(...skipping 6977 matching lines...) Expand 10 before | Expand all | Expand 10 after
10784 const String& str = String::Handle(pattern()); 10787 const String& str = String::Handle(pattern());
10785 const char* format = "JSRegExp: pattern=%s flags=%s"; 10788 const char* format = "JSRegExp: pattern=%s flags=%s";
10786 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10789 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10787 char* chars = reinterpret_cast<char*>( 10790 char* chars = reinterpret_cast<char*>(
10788 Isolate::Current()->current_zone()->Allocate(len + 1)); 10791 Isolate::Current()->current_zone()->Allocate(len + 1));
10789 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10792 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10790 return chars; 10793 return chars;
10791 } 10794 }
10792 10795
10793 } // namespace dart 10796 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698