[vm] Assert that we are not trying to construct old(reloaded) class constructor.

Construction of old class constructor is not possible since we didn't keep its fields, its structure.

Change-Id: I1e2239c0aa1012737e94c8ba42b0fc07a732b61d
Reviewed-on: https://dart-review.googlesource.com/c/77986
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This commit is contained in:
Alexander Aprelev
2018-10-05 15:52:31 +00:00
committed by commit-bot@chromium.org
parent 358b580941
commit ff3a841e2d
@@ -1555,6 +1555,13 @@ Fragment StreamingFlowGraphBuilder::BuildFunctionBody(
// initializers will be visible inside the entire body of the constructor.
// We should make a separate scope for them.
if (constructor) {
// PatchClass with different kernel_data means we are building a constructor
// for some old class. That is not supported and should not be happening as
// old classes are gone after hot reload, we don't have reference to old
// class's fields.
ASSERT(!Object::Handle(dart_function.RawOwner()).IsPatchClass() ||
(Library::Handle(Class::Handle(dart_function.Owner()).library())
.kernel_data() == dart_function.KernelData()));
body += BuildInitializers(Class::Handle(Z, dart_function.Owner()));
}