Index: runtime/vm/kernel_binary_flowgraph.cc |
diff --git a/runtime/vm/kernel_binary_flowgraph.cc b/runtime/vm/kernel_binary_flowgraph.cc |
index 33c85883c08dca768e4f896411db799a63c561f3..e34276668e7b06d77f544a49bef6386b58b371a7 100644 |
--- a/runtime/vm/kernel_binary_flowgraph.cc |
+++ b/runtime/vm/kernel_binary_flowgraph.cc |
@@ -2924,11 +2924,31 @@ Fragment StreamingFlowGraphBuilder::BuildInitializers( |
intptr_t constructor_class_parent_offset) { |
Fragment instructions; |
+ // Start by getting the position of the constructors initializer. |
+ intptr_t initializers_offset = -1; |
+ { |
+ AlternativeReadingScope alt(reader_); |
+ SkipFunctionNode(); // read constructors function node. |
+ initializers_offset = ReaderOffset(); |
+ } |
+ |
// These come from: |
// class A { |
// var x = (expr); |
// } |
+ // We don't want to do that when this is a Redirecting Constructors though |
+ // (i.e. has a single initializer being of type kRedirectingInitializer). |
+ bool is_redirecting_constructor = false; |
{ |
+ 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; |
+ } |
+ } |
+ |
+ if (!is_redirecting_constructor) { |
AlternativeReadingScope alt(reader_, constructor_class_parent_offset); |
ReadClassUntilFields(); // read first part of class. |
intptr_t list_length = ReadListLength(); // read fields list length. |
@@ -2963,9 +2983,7 @@ Fragment StreamingFlowGraphBuilder::BuildInitializers( |
// A(this.x) : super(expr), y = (expr); |
// } |
{ |
- AlternativeReadingScope alt(reader_); |
- SkipFunctionNode(); // read constructors function node. |
- |
+ AlternativeReadingScope alt(reader_, initializers_offset); |
intptr_t list_length = ReadListLength(); // read initializers list length. |
for (intptr_t i = 0; i < list_length; ++i) { |
Tag tag = ReadTag(); |