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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 17617006: Fix Dart_GetType to get the correct number of type arguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698