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

Unified Diff: runtime/vm/class_table.cc

Issue 10829446: Add HasSubclasses function to class hierarchy analysis. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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/class_table.h ('k') | runtime/vm/class_table_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/class_table.cc
===================================================================
--- runtime/vm/class_table.cc (revision 11007)
+++ runtime/vm/class_table.cc (working copy)
@@ -97,6 +97,18 @@
}
+bool ClassTable::HasSubclasses(intptr_t cid) const {
Ivan Posva 2012/08/21 03:01:27 This API has nothing to do with ClassTable, please
+ const Class& cls = Class::Handle(At(cid));
+ ASSERT(!cls.IsNull());
+ // TODO(regis): Replace assert below with ASSERT(cid > kDartObjectCid).
+ ASSERT(!cls.IsObjectClass());
+ const GrowableObjectArray& cls_direct_subclasses =
+ GrowableObjectArray::Handle(cls.direct_subclasses());
+ return
+ !cls_direct_subclasses.IsNull() && (cls_direct_subclasses.Length() > 0);
+}
+
+
// Returns true if the given array of cids contains the given cid.
static bool ContainsCid(ZoneGrowableArray<intptr_t>* cids, intptr_t cid) {
for (intptr_t i = 0; i < cids->length(); i++) {
« no previous file with comments | « runtime/vm/class_table.h ('k') | runtime/vm/class_table_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698