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

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,30 @@
// 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);
+ String& field_name = String::Handle(isolate);
+
+#define CLASS_LIST_WITH_NULL(V) \
+ V(Null) \
+ CLASS_LIST_NO_OBJECT(V)
+
+#define ADD_SET_FIELD(clazz) \
+ field_name = Symbols::New("cid"#clazz); \
+ field = Field::New(field_name, 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();
}
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/symbols.h » ('j') | runtime/vm/symbols.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698