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

Unified Diff: runtime/vm/object.h

Issue 66033006: Check type bounds of redirecting factories (issue 14699). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 30176)
+++ runtime/vm/object.h (working copy)
@@ -4230,7 +4230,9 @@
RawAbstractType* bound() const { return raw_ptr()->bound_; }
void set_bound(const AbstractType& value) const;
// Returns true if bounded_type is below upper_bound, otherwise return false
- // and set bound_error if not NULL.
+ // and set bound_error if both bounded_type and upper_bound are instantiated.
+ // If one or both are not instantiated, returning false only means that the
+ // bound cannot be checked yet and this is not an error.
bool CheckBound(const AbstractType& bounded_type,
const AbstractType& upper_bound,
Error* bound_error) const;
@@ -4308,6 +4310,10 @@
return AbstractType::Handle(type()).token_pos();
}
virtual bool IsInstantiated() const {
+ // It is not possible to encounter an instantiated bounded type with an
+ // uninstantiated upper bound. Therefore, we do not need to check if the
+ // bound is instantiated. Moreover, doing so could lead into cycles, as in
+ // class C<T extends C<C>> { }.
return AbstractType::Handle(type()).IsInstantiated();
}
virtual bool Equals(const Instance& other) const;
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698