| OLD | NEW |
| 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/resolver.h" | 5 #include "vm/resolver.h" |
| 6 | 6 |
| 7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 #include "vm/object_store.h" | 11 #include "vm/object_store.h" |
| 12 #include "vm/symbols.h" | 12 #include "vm/symbols.h" |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 DEFINE_FLAG(bool, trace_resolving, false, "Trace resolving."); | 16 DEFINE_FLAG(bool, trace_resolving, false, "Trace resolving."); |
| 17 | 17 |
| 18 | 18 |
| 19 // The actual names of named arguments are not checked by the dynamic resolver, | 19 // The actual names of named arguments are not checked by the dynamic resolver, |
| 20 // but by the method entry code. It is important that the dynamic resolver | 20 // but by the method entry code. It is important that the dynamic resolver |
| 21 // checks that no named arguments are passed to a method that does not accept | 21 // checks that no named arguments are passed to a method that does not accept |
| 22 // them, since the entry code of such a method does not check for named | 22 // them, since the entry code of such a method does not check for named |
| 23 // arguments. The dynamic resolver actually checks that a valid number of named | 23 // arguments. The dynamic resolver actually checks that a valid number of named |
| 24 // arguments is passed in. | 24 // arguments is passed in. |
| 25 RawFunction* Resolver::ResolveDynamic(const Instance& receiver, | 25 RawFunction* Resolver::ResolveDynamic(const Instance& receiver, |
| 26 const String& function_name, | 26 const String& function_name, |
| 27 const ArgumentsDescriptor& args_desc) { | 27 const ArgumentsDescriptor& args_desc) { |
| 28 // Figure out type of receiver first. | 28 // Figure out type of receiver first. |
| 29 Class& cls = Class::Handle(); | 29 const Class& cls = Class::Handle(receiver.clazz()); |
| 30 cls = receiver.clazz(); | |
| 31 // For lookups treat null as an instance of class Object. | |
| 32 if (cls.IsNullClass()) { | |
| 33 cls = Isolate::Current()->object_store()->object_class(); | |
| 34 } | |
| 35 ASSERT(!cls.IsNull()); | |
| 36 | |
| 37 return ResolveDynamicForReceiverClass(cls, function_name, args_desc); | 30 return ResolveDynamicForReceiverClass(cls, function_name, args_desc); |
| 38 } | 31 } |
| 39 | 32 |
| 40 | 33 |
| 41 RawFunction* Resolver::ResolveDynamicForReceiverClass( | 34 RawFunction* Resolver::ResolveDynamicForReceiverClass( |
| 42 const Class& receiver_class, | 35 const Class& receiver_class, |
| 43 const String& function_name, | 36 const String& function_name, |
| 44 const ArgumentsDescriptor& args_desc) { | 37 const ArgumentsDescriptor& args_desc) { |
| 45 | 38 |
| 46 Function& function = | 39 Function& function = |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 OS::Print("ResolveStatic error '%s': %s.\n", | 249 OS::Print("ResolveStatic error '%s': %s.\n", |
| 257 function_name.ToCString(), | 250 function_name.ToCString(), |
| 258 error_message.ToCString()); | 251 error_message.ToCString()); |
| 259 } | 252 } |
| 260 return Function::null(); | 253 return Function::null(); |
| 261 } | 254 } |
| 262 return function.raw(); | 255 return function.raw(); |
| 263 } | 256 } |
| 264 | 257 |
| 265 } // namespace dart | 258 } // namespace dart |
| OLD | NEW |