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

Unified Diff: runtime/vm/kernel_binary_flowgraph.cc

Issue 2992323002: [kernel] Allow local initializers with redirecting constructors. (Closed)
Patch Set: Created 3 years, 4 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/kernel_binary_flowgraph.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_binary_flowgraph.cc
diff --git a/runtime/vm/kernel_binary_flowgraph.cc b/runtime/vm/kernel_binary_flowgraph.cc
index 34963a7c5612a0db50f1968d5ccb6d3e533dbc4c..26d9cdd28414b5e1186aa56f5c8f8838a6d82579 100644
--- a/runtime/vm/kernel_binary_flowgraph.cc
+++ b/runtime/vm/kernel_binary_flowgraph.cc
@@ -1097,7 +1097,7 @@ void StreamingScopeBuilder::VisitFunctionType(bool simple) {
}
builder_->SkipListOfStrings(); // read positional parameter names.
- VisitDartType(); // read return type.
+ VisitDartType(); // read return type.
}
void StreamingScopeBuilder::VisitTypeParameterType() {
@@ -2820,10 +2820,15 @@ Fragment StreamingFlowGraphBuilder::BuildInitializers(
{
AlternativeReadingScope alt(reader_, initializers_offset);
intptr_t list_length = ReadListLength(); // read initializers list length.
- if (list_length == 1) {
- Tag tag = ReadTag();
- if (tag == kRedirectingInitializer) is_redirecting_constructor = true;
+ bool no_field_initializers = true;
+ for (intptr_t i = 0; i < list_length; ++i) {
+ if (PeekTag() == kRedirectingInitializer)
jensj 2017/08/07 09:12:21 nit: I think the style guide wants braces because
sjindel 2017/08/07 09:17:41 Done.
+ is_redirecting_constructor = true;
+ else if (PeekTag() == kFieldInitializer)
+ no_field_initializers = false;
+ SkipInitializer();
}
+ ASSERT(is_redirecting_constructor ? no_field_initializers : true);
}
if (!is_redirecting_constructor) {
@@ -2892,7 +2897,6 @@ Fragment StreamingFlowGraphBuilder::BuildInitializers(
break;
}
case kRedirectingInitializer: {
- ASSERT(list_length == 1);
NameIndex canonical_target =
ReadCanonicalNameReference(); // read target_reference.
@@ -3812,7 +3816,7 @@ void StreamingFlowGraphBuilder::SkipFunctionType(bool simple) {
}
SkipListOfStrings(); // read positional parameter names.
- SkipDartType(); // read return type.
+ SkipDartType(); // read return type.
}
void StreamingFlowGraphBuilder::SkipListOfExpressions() {
@@ -3851,6 +3855,32 @@ void StreamingFlowGraphBuilder::SkipTypeParametersList() {
}
}
+void StreamingFlowGraphBuilder::SkipInitializer() {
+ Tag tag = ReadTag();
+ ReadByte(); // read isSynthetic flag.
+ switch (tag) {
+ case kInvalidInitializer:
+ return;
+ case kFieldInitializer:
+ SkipCanonicalNameReference(); // read field_reference.
+ SkipExpression(); // read value.
+ return;
+ case kSuperInitializer:
+ SkipCanonicalNameReference(); // read target_reference.
+ SkipArguments(); // read arguments.
+ return;
+ case kRedirectingInitializer:
+ SkipCanonicalNameReference(); // read target_reference.
+ SkipArguments(); // read arguments.
+ return;
+ case kLocalInitializer:
+ SkipVariableDeclaration(); // read variable.
+ return;
+ default:
+ UNREACHABLE();
+ }
+}
+
void StreamingFlowGraphBuilder::SkipExpression() {
uint8_t payload = 0;
Tag tag = ReadTag(&payload);
@@ -5931,7 +5961,7 @@ Fragment StreamingFlowGraphBuilder::BuildClosureCreation(
instructions += Drop();
- SkipDartType(); // skip function type of the closure.
+ SkipDartType(); // skip function type of the closure.
SkipListOfDartTypes(); // skip list of type arguments.
return instructions;
« no previous file with comments | « runtime/vm/kernel_binary_flowgraph.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698