| Index: runtime/vm/dart_api_impl.cc
|
| ===================================================================
|
| --- runtime/vm/dart_api_impl.cc (revision 24377)
|
| +++ runtime/vm/dart_api_impl.cc (working copy)
|
| @@ -3704,6 +3704,11 @@
|
| if (name_str.IsNull()) {
|
| RETURN_TYPE_ERROR(isolate, class_name, String);
|
| }
|
| + // Ensure all classes are finalized.
|
| + Dart_Handle state = Api::CheckIsolateState(isolate);
|
| + if (::Dart_IsError(state)) {
|
| + return state;
|
| + }
|
| const Class& cls =
|
| Class::Handle(isolate, lib.LookupClassAllowPrivate(name_str));
|
| if (cls.IsNull()) {
|
| @@ -3711,10 +3716,14 @@
|
| return Api::NewError("Type '%s' not found in library '%s'.",
|
| name_str.ToCString(), lib_name.ToCString());
|
| }
|
| - intptr_t num_expected_type_arguments = cls.NumTypeParameters();
|
| - if (num_expected_type_arguments == 0) {
|
| + if (cls.NumTypeArguments() == 0) {
|
| + if (number_of_type_arguments != 0) {
|
| + return Api::NewError("Invalid number of type arguments specified, "
|
| + "got %"Pd" expected 0", number_of_type_arguments);
|
| + }
|
| return Api::NewHandle(isolate, Type::NewNonParameterizedType(cls));
|
| }
|
| + intptr_t num_expected_type_arguments = cls.NumTypeParameters();
|
| TypeArguments& type_args_obj = TypeArguments::Handle();
|
| if (number_of_type_arguments > 0) {
|
| if (type_arguments == NULL) {
|
| @@ -3745,12 +3754,6 @@
|
| }
|
| }
|
|
|
| - // Ensure all classes are finalized.
|
| - Dart_Handle state = Api::CheckIsolateState(isolate);
|
| - if (::Dart_IsError(state)) {
|
| - return state;
|
| - }
|
| -
|
| // Construct the type object, canonicalize it and return.
|
| const Type& instantiated_type = Type::Handle(
|
| Type::New(cls, type_args_obj, Scanner::kDummyTokenIndex));
|
|
|