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

Unified Diff: runtime/vm/object.cc

Issue 351673002: Add class id constants fields to dart:_internal class 'ClassID'. Use the fields in the library (mor… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 37613)
+++ runtime/vm/object.cc (working copy)
@@ -1372,6 +1372,29 @@
// Set up recognized state of all functions (core, math and typed data).
MethodRecognizer::InitializeState();
+ // Adds static const fields (class ids) to the class 'ClassID');
+ lib = Library::LookupLibrary(Symbols::DartInternal());
+ ASSERT(!lib.IsNull());
+ cls = lib.LookupClassAllowPrivate(Symbols::ClassID());
+ ASSERT(!cls.IsNull());
+ Field& field = Field::Handle(isolate);
+ Smi& value = Smi::Handle(isolate);
+
+#define CLASS_LIST_WITH_NULL(V) \
+ V(Null) \
+ CLASS_LIST_NO_OBJECT(V)
+
+#define ADD_SET_FIELD(clazz) \
+ field = Field::New(String::Handle(Symbols::New("cid"#clazz)), \
siva 2014/06/23 21:23:31 This String::Handle can also be hoisted out and th
srdjan 2014/06/23 22:27:35 Done.
+ true, false, true, cls, 0); \
+ value = Smi::New(k##clazz##Cid); \
+ field.set_value(value); \
+ field.set_type(Type::Handle(Type::IntType())); \
+ cls.AddField(field); \
+
+ CLASS_LIST_WITH_NULL(ADD_SET_FIELD)
+#undef ADD_SET_FIELD
+
return Error::null();
}

Powered by Google App Engine
This is Rietveld 408576698