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/dart_entry.h" | 5 #include "vm/dart_entry.h" |
6 | 6 |
| 7 #include "vm/class_finalizer.h" |
7 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
8 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
9 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
10 #include "vm/object_store.h" | 11 #include "vm/object_store.h" |
11 #include "vm/resolver.h" | 12 #include "vm/resolver.h" |
12 #include "vm/simulator.h" | 13 #include "vm/simulator.h" |
13 #include "vm/stub_code.h" | 14 #include "vm/stub_code.h" |
14 #include "vm/symbols.h" | 15 #include "vm/symbols.h" |
15 | 16 |
16 namespace dart { | 17 namespace dart { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 155 |
155 | 156 |
156 RawObject* DartEntry::InvokeConstructor(const Class& klass, | 157 RawObject* DartEntry::InvokeConstructor(const Class& klass, |
157 const Function& constructor, | 158 const Function& constructor, |
158 const Array& arguments) { | 159 const Array& arguments) { |
159 Class& ultimate_klass = Class::Handle(klass.raw()); | 160 Class& ultimate_klass = Class::Handle(klass.raw()); |
160 Function& ultimate_constructor = Function::Handle(constructor.raw()); | 161 Function& ultimate_constructor = Function::Handle(constructor.raw()); |
161 | 162 |
162 Instance& new_object = Instance::Handle(); | 163 Instance& new_object = Instance::Handle(); |
163 if (ultimate_constructor.IsRedirectingFactory()) { | 164 if (ultimate_constructor.IsRedirectingFactory()) { |
| 165 ClassFinalizer::ResolveRedirectingFactory(klass, ultimate_constructor); |
164 Type& type = Type::Handle(ultimate_constructor.RedirectionType()); | 166 Type& type = Type::Handle(ultimate_constructor.RedirectionType()); |
| 167 ultimate_constructor = ultimate_constructor.RedirectionTarget(); |
| 168 ASSERT(!ultimate_constructor.IsNull()); |
165 ultimate_klass = type.type_class(); | 169 ultimate_klass = type.type_class(); |
166 ultimate_constructor = ultimate_constructor.RedirectionTarget(); | |
167 } | 170 } |
168 if (ultimate_constructor.IsConstructor()) { | 171 if (ultimate_constructor.IsConstructor()) { |
169 // "Constructors" are really instance initializers. They are passed a newly | 172 // "Constructors" are really instance initializers. They are passed a newly |
170 // allocated object as an extra argument. | 173 // allocated object as an extra argument. |
171 new_object = Instance::New(ultimate_klass); | 174 new_object = Instance::New(ultimate_klass); |
172 } | 175 } |
173 | 176 |
174 // Create the argument list. | 177 // Create the argument list. |
175 intptr_t number_of_arguments = arguments.Length(); | 178 intptr_t number_of_arguments = arguments.Length(); |
176 intptr_t arg_index = 0; | 179 intptr_t arg_index = 0; |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 String::Handle(Field::GetterName(Symbols::_id())))); | 556 String::Handle(Field::GetterName(Symbols::_id())))); |
554 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); | 557 const Function& func = Function::Handle(cls.LookupDynamicFunction(func_name)); |
555 ASSERT(!func.IsNull()); | 558 ASSERT(!func.IsNull()); |
556 const Array& args = Array::Handle(Array::New(1)); | 559 const Array& args = Array::Handle(Array::New(1)); |
557 args.SetAt(0, port); | 560 args.SetAt(0, port); |
558 return DartEntry::InvokeFunction(func, args); | 561 return DartEntry::InvokeFunction(func, args); |
559 } | 562 } |
560 | 563 |
561 | 564 |
562 } // namespace dart | 565 } // namespace dart |
OLD | NEW |