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

Side by Side Diff: vm/dart_api_impl.cc

Issue 10115034: Add a missing arity check for top-level methods in Dart_Invoke. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 | vm/dart_api_impl_test.cc » ('j') | 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 2361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2372 } 2372 }
2373 2373
2374 // Finalize all classes if needed. 2374 // Finalize all classes if needed.
2375 if (finalize_classes) { 2375 if (finalize_classes) {
2376 const char* msg = CheckIsolateState(isolate); 2376 const char* msg = CheckIsolateState(isolate);
2377 if (msg != NULL) { 2377 if (msg != NULL) {
2378 return Api::NewError(msg); 2378 return Api::NewError(msg);
2379 } 2379 }
2380 } 2380 }
2381 2381
2382 const Function& function = 2382 Function& function = Function::Handle(isolate);
2383 Function::Handle(isolate, lib.LookupLocalFunction(function_name)); 2383 function = lib.LookupLocalFunction(function_name);
2384 // LookupLocalFunction does not check argument arity, so we do it here.
2385 if (!function.IsNull() &&
2386 !function.AreValidArgumentCounts(number_of_arguments, 0)) {
2387 function = Function::null();
2388 }
2384 if (function.IsNull()) { 2389 if (function.IsNull()) {
2385 return Api::NewError("%s: did not find top-level function '%s'.", 2390 return Api::NewError("%s: did not find top-level function '%s'.",
2386 CURRENT_FUNC, 2391 CURRENT_FUNC,
2387 function_name.ToCString()); 2392 function_name.ToCString());
2388 } 2393 }
2389 return Api::NewHandle( 2394 return Api::NewHandle(
2390 isolate, DartEntry::InvokeStatic(function, dart_args, kNoArgNames)); 2395 isolate, DartEntry::InvokeStatic(function, dart_args, kNoArgNames));
2391 2396
2392 } else { 2397 } else {
2393 return Api::NewError( 2398 return Api::NewError(
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
3442 *buffer = NULL; 3447 *buffer = NULL;
3443 } 3448 }
3444 delete debug_region; 3449 delete debug_region;
3445 } else { 3450 } else {
3446 *buffer = NULL; 3451 *buffer = NULL;
3447 *buffer_size = 0; 3452 *buffer_size = 0;
3448 } 3453 }
3449 } 3454 }
3450 3455
3451 } // namespace dart 3456 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698