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

Unified Diff: runtime/vm/debugger_api_impl.cc

Issue 20575003: Fix for issue 12136 (do not try to copy type arguments if the base class (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger_api_impl.cc
===================================================================
--- runtime/vm/debugger_api_impl.cc (revision 25667)
+++ runtime/vm/debugger_api_impl.cc (working copy)
@@ -523,9 +523,16 @@
DARTSCOPE(isolate);
UNWRAP_AND_CHECK_PARAM(Type, type, type_in);
+ if (!type.IsFinalized()) {
+ return Api::NewError("%s: type in 'type_in' is not a finalized type",
+ CURRENT_FUNC);
+ }
+ if (!type.IsInstantiated()) {
+ return Api::NewError("%s: type in 'type_in' is not an instantiated type",
+ CURRENT_FUNC);
+ }
const Class& cls= Class::Handle(type.type_class());
- intptr_t num_expected_type_arguments = cls.NumTypeParameters();
- if (num_expected_type_arguments == 0) {
+ if (cls.NumTypeParameters() == 0) {
// The super type has no type parameters or it is already instantiated
// just return it.
const AbstractType& type = AbstractType::Handle(cls.super_type());
@@ -536,26 +543,25 @@
}
// Set up the type arguments array for the super class type.
const Class& super_cls = Class::Handle(cls.SuperClass());
- num_expected_type_arguments = super_cls.NumTypeParameters();
+ intptr_t num_expected_type_arguments = super_cls.NumTypeArguments();
+ TypeArguments& super_type_args_array = TypeArguments::Handle();
const AbstractTypeArguments& type_args_array =
AbstractTypeArguments::Handle(type.arguments());
- const TypeArguments& super_type_args_array =
- TypeArguments::Handle(TypeArguments::New(num_expected_type_arguments));
- AbstractType& type_arg = AbstractType::Handle();
- intptr_t index_offset =
- super_cls.NumTypeArguments() - num_expected_type_arguments;
- for (intptr_t i = 0; i < num_expected_type_arguments; i++) {
- type_arg ^= type_args_array.TypeAt(i + index_offset);
- super_type_args_array.SetTypeAt(i, type_arg);
+ if (!type_args_array.IsNull() && (num_expected_type_arguments > 0)) {
+ super_type_args_array = TypeArguments::New(num_expected_type_arguments);
+ AbstractType& type_arg = AbstractType::Handle();
+ for (intptr_t i = 0; i < num_expected_type_arguments; i++) {
+ type_arg ^= type_args_array.TypeAt(i);
+ super_type_args_array.SetTypeAt(i, type_arg);
+ }
}
// Construct the super type object, canonicalize it and return.
Type& instantiated_type = Type::Handle(
Type::New(super_cls, super_type_args_array, Scanner::kDummyTokenIndex));
ASSERT(!instantiated_type.IsNull());
- instantiated_type ^= ClassFinalizer::FinalizeType(
- super_cls, instantiated_type, ClassFinalizer::kCanonicalize);
- return Api::NewHandle(isolate, instantiated_type.raw());
+ instantiated_type.SetIsFinalized();
+ return Api::NewHandle(isolate, instantiated_type.Canonicalize());
}
« no previous file with comments | « no previous file | runtime/vm/debugger_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698