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

Unified Diff: runtime/vm/object.cc

Issue 33313003: Report use of malbounded interface in type test. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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/exceptions.cc ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 28940)
+++ runtime/vm/object.cc (working copy)
@@ -2788,7 +2788,7 @@
AbstractType& interface = AbstractType::Handle();
Class& interface_class = Class::Handle();
AbstractTypeArguments& interface_args = AbstractTypeArguments::Handle();
- Error& args_bound_error = Error::Handle();
+ Error& error = Error::Handle();
for (intptr_t i = 0; i < interfaces.Length(); i++) {
interface ^= interfaces.At(i);
if (!interface.IsFinalized()) {
@@ -2796,6 +2796,15 @@
// unfinalized interface will postpone bound checking to run time.
continue;
}
+ error = Error::null();
+ if (interface.IsMalboundedWithError(&error)) {
+ // Return the first bound error to the caller if it requests it.
+ if ((bound_error != NULL) && bound_error->IsNull()) {
+ ASSERT(!error.IsNull());
+ *bound_error = error.raw();
+ }
+ continue; // Another interface may work better.
+ }
interface_class = interface.type_class();
interface_args = interface.arguments();
if (!interface_args.IsNull() && !interface_args.IsInstantiated()) {
@@ -2807,13 +2816,12 @@
// parameters of the interface are at the end of the type vector,
// after the type arguments of the super type of this type.
// The index of the type parameters is adjusted upon finalization.
- args_bound_error = Error::null();
- interface_args = interface_args.InstantiateFrom(type_arguments,
- &args_bound_error);
- if (!args_bound_error.IsNull()) {
+ error = Error::null();
+ interface_args = interface_args.InstantiateFrom(type_arguments, &error);
+ if (!error.IsNull()) {
// Return the first bound error to the caller if it requests it.
if ((bound_error != NULL) && bound_error->IsNull()) {
- *bound_error = args_bound_error.raw();
+ *bound_error = error.raw();
}
continue; // Another interface may work better.
}
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698