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

Unified Diff: runtime/vm/object.cc

Issue 10828053: Support const modifier in fields, variables (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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/object.h ('k') | runtime/vm/object_test.cc » ('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 9982)
+++ runtime/vm/object.cc (working copy)
@@ -4466,6 +4466,7 @@
RawField* Field::New(const String& name,
bool is_static,
bool is_final,
+ bool is_const,
intptr_t token_pos) {
ASSERT(name.IsOneByteString());
const Field& result = Field::Handle(Field::New());
@@ -4477,6 +4478,7 @@
result.SetOffset(0);
}
result.set_is_final(is_final);
+ result.set_is_const(is_const);
result.set_token_pos(token_pos);
result.set_has_initializer(false);
return result.raw();
@@ -4486,15 +4488,16 @@
const char* Field::ToCString() const {
const char* kF0 = is_static() ? " static" : "";
const char* kF1 = is_final() ? " final" : "";
- const char* kFormat = "Field <%s.%s>:%s%s";
+ const char* kF2 = is_const() ? " const" : "";
+ const char* kFormat = "Field <%s.%s>:%s%s%s";
const char* field_name = String::Handle(name()).ToCString();
const Class& cls = Class::Handle(owner());
const char* cls_name = String::Handle(cls.Name()).ToCString();
intptr_t len =
- OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1) + 1;
+ OS::SNPrint(NULL, 0, kFormat, cls_name, field_name, kF0, kF1, kF2) + 1;
char* chars = reinterpret_cast<char*>(
Isolate::Current()->current_zone()->Allocate(len));
- OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1);
+ OS::SNPrint(chars, len, kFormat, cls_name, field_name, kF0, kF1, kF2);
return chars;
}
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698