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

Unified Diff: runtime/vm/dart_entry.cc

Issue 23604003: Support named and optional positional arguments in reflective invocation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix wrong variable in async unwrap error message Created 7 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_entry.cc
diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc
index b6ba072664ddbe05c9209f2901b8f03b9735c9e0..2c018c8a5b012bec0f47a6ecfb010a0f695ff036 100644
--- a/runtime/vm/dart_entry.cc
+++ b/runtime/vm/dart_entry.cc
@@ -152,61 +152,6 @@ RawObject* DartEntry::InvokeNoSuchMethod(const Instance& receiver,
}
-RawObject* DartEntry::InvokeConstructor(const Class& klass,
- const Function& constructor,
- const Array& arguments) {
- Class& ultimate_klass = Class::Handle(klass.raw());
- Function& ultimate_constructor = Function::Handle(constructor.raw());
-
- Instance& new_object = Instance::Handle();
- if (ultimate_constructor.IsRedirectingFactory()) {
- ClassFinalizer::ResolveRedirectingFactory(klass, ultimate_constructor);
- Type& type = Type::Handle(ultimate_constructor.RedirectionType());
- ultimate_constructor = ultimate_constructor.RedirectionTarget();
- ASSERT(!ultimate_constructor.IsNull());
- ultimate_klass = type.type_class();
- }
- if (ultimate_constructor.IsConstructor()) {
- // "Constructors" are really instance initializers. They are passed a newly
- // allocated object as an extra argument.
- new_object = Instance::New(ultimate_klass);
- }
-
- // Create the argument list.
- intptr_t number_of_arguments = arguments.Length();
- intptr_t arg_index = 0;
- int extra_args = (ultimate_constructor.IsConstructor() ? 2 : 1);
- const Array& args =
- Array::Handle(Array::New(number_of_arguments + extra_args));
- if (ultimate_constructor.IsConstructor()) {
- // Constructors get the uninitialized object and a constructor phase.
- args.SetAt(arg_index++, new_object);
- args.SetAt(arg_index++,
- Smi::Handle(Smi::New(Function::kCtorPhaseAll)));
- } else {
- // Factories get type arguments.
- args.SetAt(arg_index++, TypeArguments::Handle());
- }
- Object& argument = Object::Handle();
- for (int i = 0; i < number_of_arguments; i++) {
- argument = (arguments.At(i));
- args.SetAt(arg_index++, argument);
- }
-
- // Invoke the constructor and return the new object.
- const Object& result =
- Object::Handle(DartEntry::InvokeFunction(ultimate_constructor, args));
- if (result.IsError()) {
- return result.raw();
- }
- if (ultimate_constructor.IsConstructor()) {
- return new_object.raw();
- } else {
- return result.raw();
- }
-}
-
-
ArgumentsDescriptor::ArgumentsDescriptor(const Array& array)
: array_(array) {
}
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698