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

Unified Diff: runtime/vm/parser.cc

Issue 1406943006: Pass type argument to Field construction, thus freezing that field, denoting it cannot be changed l… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: f Created 5 years, 1 month 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_test.cc ('k') | no next file » | 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 86e9ae7c16223cd1ea4284fc3438126e02c12a8f..ee1b60fe8313faa133a770b14f72a20f3058d33f 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -4047,8 +4047,8 @@ void Parser::ParseFieldDefinition(ClassDesc* members, MemberDesc* field) {
field->has_const,
is_reflectable,
current_class(),
+ *field->type,
field->name_pos);
- class_field.set_type(*field->type);
class_field.set_has_initializer(has_initializer);
members->AddField(class_field);
field->field_ = &class_field;
@@ -4728,8 +4728,8 @@ void Parser::ParseEnumDefinition(const Class& cls) {
false, // Not const.
true, // Is reflectable.
cls,
+ int_type,
cls.token_pos());
- index_field.set_type(int_type);
enum_members.AddField(index_field);
// Add implicit getter for index field.
@@ -4800,8 +4800,8 @@ void Parser::ParseEnumDefinition(const Class& cls) {
/* is_const = */ true,
/* is_reflectable = */ true,
cls,
+ Object::dynamic_type(),
cls.token_pos());
- enum_value.set_type(Object::dynamic_type());
enum_value.set_has_initializer(false);
enum_members.AddField(enum_value);
// Initialize the field with the ordinal value. It will be patched
@@ -4838,8 +4838,8 @@ void Parser::ParseEnumDefinition(const Class& cls) {
/* is_const = */ true,
/* is_reflectable = */ true,
cls,
+ Type::Handle(Z, Type::ArrayType()),
cls.token_pos());
- values_field.set_type(Type::Handle(Z, Type::ArrayType()));
enum_members.AddField(values_field);
// Allocate the immutable array containing the enumeration values.
@@ -5447,8 +5447,7 @@ void Parser::ParseTopLevelVariable(TopLevel* top_level,
const bool is_reflectable =
!(library_.is_dart_scheme() && library_.IsPrivate(var_name));
field = Field::New(var_name, is_static, is_final, is_const, is_reflectable,
- current_class(), name_pos);
- field.set_type(type);
+ current_class(), type, name_pos);
field.SetStaticValue(Object::null_instance(), true);
top_level->AddField(field);
library_.AddObject(field, var_name);
« no previous file with comments | « runtime/vm/object_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698