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

Unified Diff: runtime/vm/parser.cc

Issue 1289643005: Rename accessors of class Field to make it more apparent as to what is being accessed - static fiel… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add-comment Created 5 years, 3 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.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 5e341f0f7e41c8c5e8eba141cecd8972beff2c09..12b7954b14b15afec6bc74eaeb08846d5ce5b6f1 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -4061,7 +4061,7 @@ void Parser::ParseFieldDefinition(ClassDesc* members, MemberDesc* field) {
// For static final fields (this includes static const fields), set value to
// "uninitialized" and create a kImplicitStaticFinalGetter getter method.
if (field->has_static && has_initializer) {
- class_field.set_value(init_value);
+ class_field.SetStaticValue(init_value, true);
if (!has_simple_literal) {
String& getter_name =
String::Handle(Z, Field::GetterSymbol(*field->name));
@@ -4800,7 +4800,7 @@ void Parser::ParseEnumDefinition(const Class& cls) {
// Initialize the field with the ordinal value. It will be patched
// later with the enum constant instance.
const Smi& ordinal_value = Smi::Handle(Z, Smi::New(i));
- enum_value.set_value(ordinal_value);
+ enum_value.SetStaticValue(ordinal_value, true);
enum_value.RecordStore(ordinal_value);
i++;
@@ -4838,7 +4838,7 @@ void Parser::ParseEnumDefinition(const Class& cls) {
// Allocate the immutable array containing the enumeration values.
// The actual enum instance values will be patched in later.
const Array& values_array = Array::Handle(Z, Array::New(i, Heap::kOld));
- values_field.set_value(values_array);
+ values_field.SetStaticValue(values_array, true);
values_field.RecordStore(values_array);
// Create a static field that contains the list of enumeration names.
@@ -4849,7 +4849,7 @@ void Parser::ParseEnumDefinition(const Class& cls) {
names_field = names_field.Clone(cls);
enum_members.AddField(names_field);
const Array& names_array = Array::Handle(Array::MakeArray(enum_names));
- names_field.set_value(names_array);
+ names_field.SetStaticValue(names_array, true);
names_field.RecordStore(names_array);
// Clone the toString() function from the helper class.
@@ -5442,7 +5442,7 @@ void Parser::ParseTopLevelVariable(TopLevel* top_level,
field = Field::New(var_name, is_static, is_final, is_const, is_reflectable,
current_class(), name_pos);
field.set_type(type);
- field.set_value(Object::null_instance());
+ field.SetStaticValue(Object::null_instance(), true);
top_level->AddField(field);
library_.AddObject(field, var_name);
if (metadata_pos >= 0) {
@@ -5456,7 +5456,7 @@ void Parser::ParseTopLevelVariable(TopLevel* top_level,
has_simple_literal = IsSimpleLiteral(type, &field_value);
}
SkipExpr();
- field.set_value(field_value);
+ field.SetStaticValue(field_value, true);
field.set_has_initializer(true);
if (!has_simple_literal) {
@@ -10800,10 +10800,11 @@ static AstNode* LiteralIfStaticConst(Zone* zone, AstNode* expr) {
const Field& field = expr->AsLoadStaticFieldNode()->field();
if (field.is_const() &&
!expr->AsLoadStaticFieldNode()->is_deferred_reference()) {
- ASSERT(field.value() != Object::sentinel().raw());
- ASSERT(field.value() != Object::transition_sentinel().raw());
- return new(zone) LiteralNode(expr->token_pos(),
- Instance::ZoneHandle(zone, field.value()));
+ ASSERT(field.StaticValue() != Object::sentinel().raw());
+ ASSERT(field.StaticValue() != Object::transition_sentinel().raw());
+ return new(zone) LiteralNode(
+ expr->token_pos(),
+ Instance::ZoneHandle(zone, field.StaticValue()));
}
}
return expr;
@@ -11982,7 +11983,7 @@ StaticGetterNode* Parser::RunStaticFieldInitializer(const Field& field,
String::Handle(Z, Field::GetterSymbol(field_name));
const Function& getter = Function::Handle(Z,
field_owner.LookupStaticFunction(getter_name));
- const Instance& value = Instance::Handle(Z, field.value());
+ const Instance& value = Instance::Handle(Z, field.StaticValue());
if (value.raw() == Object::transition_sentinel().raw()) {
if (field.is_const()) {
ReportError("circular dependency while initializing static field '%s'",
@@ -11997,7 +11998,7 @@ StaticGetterNode* Parser::RunStaticFieldInitializer(const Field& field,
// not been evaluated. If the field is const, call the static getter method
// to evaluate the expression and canonicalize the value.
if (field.is_const()) {
- field.set_value(Object::transition_sentinel());
+ field.SetStaticValue(Object::transition_sentinel());
const int kNumArguments = 0; // no arguments.
const Function& func = Function::Handle(Z,
Resolver::ResolveStatic(field_owner,
@@ -12018,7 +12019,7 @@ StaticGetterNode* Parser::RunStaticFieldInitializer(const Field& field,
// generated AST is not deterministic. Therefore mark the function as
// not optimizable.
current_function().SetIsOptimizable(false);
- field.set_value(Object::null_instance());
+ field.SetStaticValue(Object::null_instance());
// It is a compile-time error if evaluation of a compile-time constant
// would raise an exception.
const String& field_name = String::Handle(Z, field.name());
@@ -12035,7 +12036,7 @@ StaticGetterNode* Parser::RunStaticFieldInitializer(const Field& field,
Instance& instance = Instance::Handle(Z);
instance ^= const_value.raw();
instance = TryCanonicalize(instance, field_ref_pos);
- field.set_value(instance);
+ field.SetStaticValue(instance);
return NULL; // Constant
} else {
return new(Z) StaticGetterNode(
@@ -13897,9 +13898,9 @@ const Instance& Parser::EvaluateConstExpr(intptr_t expr_pos, AstNode* expr) {
// We already checked that this field is const and has been
// initialized.
ASSERT(field.is_const());
- ASSERT(field.value() != Object::sentinel().raw());
- ASSERT(field.value() != Object::transition_sentinel().raw());
- return Instance::ZoneHandle(Z, field.value());
+ ASSERT(field.StaticValue() != Object::sentinel().raw());
+ ASSERT(field.StaticValue() != Object::transition_sentinel().raw());
+ return Instance::ZoneHandle(Z, field.StaticValue());
} else {
ASSERT(expr->EvalConstExpr() != NULL);
ReturnNode* ret = new(Z) ReturnNode(expr->token_pos(), expr);
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698