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/flags.h" | 7 #include "vm/flags.h" |
8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/object_store.h" | 10 #include "vm/object_store.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 return Function::null(); | 69 return Function::null(); |
70 } | 70 } |
71 return function.raw(); | 71 return function.raw(); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 // Method extractors are used to create implicit closures from methods. | 75 // Method extractors are used to create implicit closures from methods. |
76 // When an expression obj.M is evaluated for the first time and receiver obj | 76 // When an expression obj.M is evaluated for the first time and receiver obj |
77 // does not have a getter called M but has a method called M then an extractor | 77 // does not have a getter called M but has a method called M then an extractor |
78 // is created and injected as a getter (under the name get:M) into the class | 78 // is created and injected as a getter (under the name get:M) into the class |
79 // ownining method M. | 79 // owning method M. |
80 static RawFunction* CreateMethodExtractor(const String& getter_name, | 80 static RawFunction* CreateMethodExtractor(const String& getter_name, |
81 const Function& method) { | 81 const Function& method) { |
82 const Function& closure_function = | 82 const Function& closure_function = |
83 Function::Handle(method.ImplicitClosureFunction()); | 83 Function::Handle(method.ImplicitClosureFunction()); |
84 | 84 |
85 const Class& owner = Class::Handle(closure_function.Owner()); | 85 const Class& owner = Class::Handle(closure_function.Owner()); |
86 Function& extractor = Function::Handle( | 86 Function& extractor = Function::Handle( |
87 Function::New(String::Handle(Symbols::New(getter_name)), | 87 Function::New(String::Handle(Symbols::New(getter_name)), |
88 RawFunction::kMethodExtractor, | 88 RawFunction::kMethodExtractor, |
89 false, // Not static. | 89 false, // Not static. |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 OS::Print("ResolveStatic error '%s': %s.\n", | 250 OS::Print("ResolveStatic error '%s': %s.\n", |
251 function_name.ToCString(), | 251 function_name.ToCString(), |
252 error_message.ToCString()); | 252 error_message.ToCString()); |
253 } | 253 } |
254 return Function::null(); | 254 return Function::null(); |
255 } | 255 } |
256 return function.raw(); | 256 return function.raw(); |
257 } | 257 } |
258 | 258 |
259 } // namespace dart | 259 } // namespace dart |
OLD | NEW |