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

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

Issue 10915022: Implement argument definition test in the vm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | runtime/vm/ast.h » ('j') | runtime/vm/parser.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/native_entry.h" 8 #include "vm/native_entry.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 10
(...skipping 25 matching lines...) Expand all
36 // found. 36 // found.
37 Class& instance_class = Class::Handle(instance.clazz()); 37 Class& instance_class = Class::Handle(instance.clazz());
38 Function& function = 38 Function& function =
39 Function::Handle(instance_class.LookupDynamicFunction(function_name)); 39 Function::Handle(instance_class.LookupDynamicFunction(function_name));
40 while (function.IsNull()) { 40 while (function.IsNull()) {
41 instance_class = instance_class.SuperClass(); 41 instance_class = instance_class.SuperClass();
42 if (instance_class.IsNull()) break; 42 if (instance_class.IsNull()) break;
43 function = instance_class.LookupDynamicFunction(function_name); 43 function = instance_class.LookupDynamicFunction(function_name);
44 } 44 }
45 if (!function.IsNull()) { 45 if (!function.IsNull()) {
46 const int total_num_parameters = 46 const int total_num_parameters = function.NumberOfParameters();
47 function.num_fixed_parameters() + function.num_optional_parameters();
48 const Array& array = Array::Handle(Array::New(total_num_parameters - 1)); 47 const Array& array = Array::Handle(Array::New(total_num_parameters - 1));
49 // Skip receiver. 48 // Skip receiver.
50 for (int i = 1; i < total_num_parameters; i++) { 49 for (int i = 1; i < total_num_parameters; i++) {
51 array.SetAt(i - 1, String::Handle(function.ParameterNameAt(i))); 50 array.SetAt(i - 1, String::Handle(function.ParameterNameAt(i)));
52 } 51 }
53 dart_arguments.Add(&array); 52 dart_arguments.Add(&array);
54 } 53 }
55 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments); 54 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments);
56 return Object::null(); 55 return Object::null();
57 } 56 }
58 57
59 } // namespace dart 58 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast.h » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698