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 #ifndef VM_RESOLVER_H_ | 5 #ifndef VM_RESOLVER_H_ |
6 #define VM_RESOLVER_H_ | 6 #define VM_RESOLVER_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
11 | 11 |
12 // Forward declarations. | 12 // Forward declarations. |
13 class Array; | 13 class Array; |
14 class Class; | 14 class Class; |
15 class Instance; | 15 class Instance; |
16 class Library; | 16 class Library; |
17 class RawFunction; | 17 class RawFunction; |
18 class String; | 18 class String; |
| 19 class ArgumentsDescriptor; |
19 | 20 |
20 | 21 |
21 // Resolver abstracts functionality needed to resolve dart functions at | 22 // Resolver abstracts functionality needed to resolve dart functions at |
22 // invocations. | 23 // invocations. |
23 class Resolver : public AllStatic { | 24 class Resolver : public AllStatic { |
24 public: | 25 public: |
25 // Resolve specified dart instance function. | 26 // Resolve specified dart instance function. |
26 static RawFunction* ResolveDynamic(const Instance& receiver, | 27 static RawFunction* ResolveDynamic(const Instance& receiver, |
27 const String& function_name, | 28 const String& function_name, |
28 int num_arguments, | 29 const ArgumentsDescriptor& args_desc); |
29 int num_named_arguments); | |
30 | 30 |
31 static RawFunction* ResolveDynamicForReceiverClass( | 31 static RawFunction* ResolveDynamicForReceiverClass( |
32 const Class& receiver_class, | 32 const Class& receiver_class, |
33 const String& function_name, | 33 const String& function_name, |
34 int num_arguments, | 34 const ArgumentsDescriptor& args_desc); |
35 int num_named_arguments); | |
36 | 35 |
37 static RawFunction* ResolveDynamicAnyArgs( | 36 static RawFunction* ResolveDynamicAnyArgs( |
38 const Class& receiver_class, | 37 const Class& receiver_class, |
39 const String& function_name); | 38 const String& function_name); |
40 | 39 |
41 enum StaticResolveType { | 40 enum StaticResolveType { |
42 kIsQualified, | 41 kIsQualified, |
43 kNotQualified | 42 kNotQualified |
44 }; | 43 }; |
45 | 44 |
46 // Resolve specified dart static function. If library.IsNull, use | 45 // Resolve specified dart static function. If library.IsNull, use |
47 // either application library or core library if no application library | 46 // either application library or core library if no application library |
48 // exists. Passing negative num_arguments means that the function | 47 // exists. Passing negative num_arguments means that the function |
49 // will be resolved by name only. | 48 // will be resolved by name only. |
50 // Otherwise null is returned if the number or names of arguments are not | 49 // Otherwise null is returned if the number or names of arguments are not |
51 // valid for the resolved function. | 50 // valid for the resolved function. |
52 static RawFunction* ResolveStatic(const Library& library, | 51 static RawFunction* ResolveStatic(const Library& library, |
53 const String& cls_name, | 52 const String& cls_name, |
54 const String& function_name, | 53 const String& function_name, |
55 int num_arguments, | 54 intptr_t num_arguments, |
56 const Array& argument_names, | 55 const Array& argument_names, |
57 StaticResolveType resolve_type); | 56 StaticResolveType resolve_type); |
58 | 57 |
59 // Resolve specified dart static function. | 58 // Resolve specified dart static function. |
60 static RawFunction* ResolveStaticByName(const Class& cls, | 59 static RawFunction* ResolveStaticByName(const Class& cls, |
61 const String& function_name, | 60 const String& function_name, |
62 StaticResolveType resolve_type); | 61 StaticResolveType resolve_type); |
63 | 62 |
64 // Resolve specified dart static function with specified arity. | 63 // Resolve specified dart static function with specified arity. |
65 static RawFunction* ResolveStatic(const Class& cls, | 64 static RawFunction* ResolveStatic(const Class& cls, |
66 const String& function_name, | 65 const String& function_name, |
67 int num_arguments, | 66 intptr_t num_arguments, |
68 const Array& argument_names, | 67 const Array& argument_names, |
69 StaticResolveType resolve_type); | 68 StaticResolveType resolve_type); |
70 }; | 69 }; |
71 | 70 |
72 } // namespace dart | 71 } // namespace dart |
73 | 72 |
74 #endif // VM_RESOLVER_H_ | 73 #endif // VM_RESOLVER_H_ |
OLD | NEW |