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

Unified Diff: runtime/vm/parser.cc

Issue 12529008: Collect type feedback for fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index cb4bae56abe7598613b23681d1a61a701c2aed95..8dd1a560a6a16e02ffcc053886850ebc03506390 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -989,7 +989,6 @@ SequenceNode* Parser::ParseInstanceSetter(const Function& func) {
StoreInstanceFieldNode* store_field =
new StoreInstanceFieldNode(ident_pos, receiver, field, value);
-
current_block_->statements->Add(store_field);
current_block_->statements->Add(new ReturnNode(ident_pos));
return CloseBlock();
@@ -1801,9 +1800,10 @@ void Parser::CheckConstFieldsInitialized(const Class& cls) {
SequenceNode* initializers = current_block_->statements;
for (int field_num = 0; field_num < fields.Length(); field_num++) {
field ^= fields.At(field_num);
- if (field.is_static() || !field.is_final()) {
+ if (field.is_static()) {
continue;
}
+
bool found = false;
for (int i = 0; i < initializers->length(); i++) {
found = false;
@@ -1816,9 +1816,14 @@ void Parser::CheckConstFieldsInitialized(const Class& cls) {
}
}
}
- if (!found) {
+
+ if (found) continue;
+
+ if (field.is_final()) {
ErrorMsg("final field '%s' not initialized",
String::Handle(field.name()).ToCString());
+ } else {
+ field.UpdateCid(kNullCid);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698