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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 1569213003: Eliminate phase parameter in constructors (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/lib/mirrors.cc ('k') | runtime/vm/dart_entry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 8a9e31ecf3ecb99fbf2fba69486d8b3804c142d9..a1c6e32638cfcf71a092f24d31b3d1287b673c2f 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -2747,10 +2747,9 @@ static RawObject* ThrowArgumentError(const char* exception_message) {
}
Instance& exception = Instance::Handle(zone);
exception = Instance::New(cls);
- const Array& args = Array::Handle(zone, Array::New(3));
+ const Array& args = Array::Handle(zone, Array::New(2));
args.SetAt(0, exception);
- args.SetAt(1, Smi::Handle(zone, Smi::New(Function::kCtorPhaseAll)));
- args.SetAt(2, String::Handle(String::New(exception_message)));
+ args.SetAt(1, String::Handle(String::New(exception_message)));
result = DartEntry::InvokeFunction(constructor, args);
if (result.IsError()) return result.raw();
ASSERT(result.IsNull());
@@ -3604,7 +3603,7 @@ static RawObject* ResolveConstructor(const char* current_func,
return ApiError::New(message);
}
}
- int extra_args = (constructor.IsGenerativeConstructor() ? 2 : 1);
+ int extra_args = 1;
String& error_message = String::Handle();
if (!constructor.AreValidArgumentCounts(num_args + extra_args,
0,
@@ -3718,11 +3717,11 @@ DART_EXPORT Dart_Handle Dart_New(Dart_Handle type,
// Create the argument list.
intptr_t arg_index = 0;
- int extra_args = (constructor.IsGenerativeConstructor() ? 2 : 1);
+ int extra_args = 1;
const Array& args =
Array::Handle(Z, Array::New(number_of_arguments + extra_args));
if (constructor.IsGenerativeConstructor()) {
- // Constructors get the uninitialized object and a constructor phase.
+ // Constructors get the uninitialized object.
if (!type_arguments.IsNull()) {
// The type arguments will be null if the class has no type parameters, in
// which case the following call would fail because there is no slot
@@ -3730,7 +3729,6 @@ DART_EXPORT Dart_Handle Dart_New(Dart_Handle type,
new_object.SetTypeArguments(type_arguments);
}
args.SetAt(arg_index++, new_object);
- args.SetAt(arg_index++, Smi::Handle(Z, Smi::New(Function::kCtorPhaseAll)));
} else {
// Factories get type arguments.
args.SetAt(arg_index++, type_arguments);
@@ -3922,14 +3920,14 @@ DART_EXPORT Dart_Handle Dart_InvokeConstructor(Dart_Handle object,
TypeArguments::Handle(Z, type_obj.arguments());
const Function& constructor =
Function::Handle(Z, cls.LookupFunctionAllowPrivate(dot_name));
- const int extra_args = 2;
+ const int extra_args = 1;
if (!constructor.IsNull() &&
constructor.IsGenerativeConstructor() &&
constructor.AreValidArgumentCounts(number_of_arguments + extra_args,
0,
NULL)) {
// Create the argument list.
- // Constructors get the uninitialized object and a constructor phase.
+ // Constructors get the uninitialized object.
if (!type_arguments.IsNull()) {
// The type arguments will be null if the class has no type
// parameters, in which case the following call would fail
@@ -3943,7 +3941,6 @@ DART_EXPORT Dart_Handle Dart_InvokeConstructor(Dart_Handle object,
T, number_of_arguments, arguments, extra_args, &args);
if (!::Dart_IsError(result)) {
args.SetAt(0, instance);
- args.SetAt(1, Smi::Handle(Z, Smi::New(Function::kCtorPhaseAll)));
const Object& retval = Object::Handle(Z,
DartEntry::InvokeFunction(constructor, args));
if (retval.IsError()) {
« no previous file with comments | « runtime/lib/mirrors.cc ('k') | runtime/vm/dart_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698