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

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

Issue 11231074: Change signature of noSuchMethod to take an InvocationMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: One more test expectation Created 8 years, 1 month 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 | « runtime/lib/invocation_mirror_patch.dart ('k') | runtime/lib/object_patch.dart » ('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) 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
11 namespace dart { 11 namespace dart {
12 12
13 DEFINE_NATIVE_ENTRY(Object_toString, 1) { 13 DEFINE_NATIVE_ENTRY(Object_toString, 1) {
14 const Instance& instance = Instance::CheckedHandle(arguments->At(0)); 14 const Instance& instance = Instance::CheckedHandle(arguments->At(0));
15 const char* c_str = instance.ToCString(); 15 const char* c_str = instance.ToCString();
16 return String::New(c_str); 16 return String::New(c_str);
17 } 17 }
18 18
19 19
20 DEFINE_NATIVE_ENTRY(Object_noSuchMethod, 3) { 20 DEFINE_NATIVE_ENTRY(Object_noSuchMethod, 3) {
21 const Instance& instance = Instance::CheckedHandle(arguments->At(0)); 21 const Instance& instance = Instance::CheckedHandle(arguments->At(0));
22 GET_NATIVE_ARGUMENT(String, function_name, arguments->At(1)); 22 GET_NATIVE_ARGUMENT(String, function_name, arguments->At(1));
23 GET_NATIVE_ARGUMENT(Array, func_args, arguments->At(2)); 23 GET_NATIVE_ARGUMENT(Array, func_args, arguments->At(2));
24 if (instance.IsNull()) { 24 if (instance.IsNull()) {
25 GrowableArray<const Object*> args; 25 GrowableArray<const Object*> args;
26 args.Add(&function_name); 26 args.Add(&function_name);
27 args.Add(&func_args); 27 args.Add(&func_args);
28 Exceptions::ThrowByType(Exceptions::kNullPointer, args); 28 Exceptions::ThrowByType(Exceptions::kNullPointer, args);
29 } 29 }
30 const Object& null_object = Object::Handle(Object::null());
30 GrowableArray<const Object*> dart_arguments(3); 31 GrowableArray<const Object*> dart_arguments(3);
31 dart_arguments.Add(&instance); 32 dart_arguments.Add(&instance);
32 dart_arguments.Add(&function_name); 33 dart_arguments.Add(&function_name);
33 dart_arguments.Add(&func_args); 34 dart_arguments.Add(&func_args);
35 dart_arguments.Add(&null_object);
34 36
35 // Report if a function with same name (but different arguments) has been 37 // Report if a function with same name (but different arguments) has been
36 // found. 38 // found.
37 Class& instance_class = Class::Handle(instance.clazz()); 39 Class& instance_class = Class::Handle(instance.clazz());
38 Function& function = 40 Function& function =
39 Function::Handle(instance_class.LookupDynamicFunction(function_name)); 41 Function::Handle(instance_class.LookupDynamicFunction(function_name));
40 while (function.IsNull()) { 42 while (function.IsNull()) {
41 instance_class = instance_class.SuperClass(); 43 instance_class = instance_class.SuperClass();
42 if (instance_class.IsNull()) break; 44 if (instance_class.IsNull()) break;
43 function = instance_class.LookupDynamicFunction(function_name); 45 function = instance_class.LookupDynamicFunction(function_name);
(...skipping 18 matching lines...) Expand all
62 return type.Canonicalize(); 64 return type.Canonicalize();
63 } 65 }
64 66
65 67
66 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { 68 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) {
67 const AbstractType& type = AbstractType::CheckedHandle(arguments->At(0)); 69 const AbstractType& type = AbstractType::CheckedHandle(arguments->At(0));
68 return type.Name(); 70 return type.Name();
69 } 71 }
70 72
71 } // namespace dart 73 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/invocation_mirror_patch.dart ('k') | runtime/lib/object_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698