if (!this->emitInitField(*T, FieldToInit->Offset, Initializer))
return false;
+
+ if (!this->emitPopPtr(Initializer))
+ return false;
} else {
// Non-primitive case. Get a pointer to the field-to-initialize
// on the stack and recurse into visitInitializer().
if (!this->emitInitField(*T, F->Offset, InitExpr))
return false;
+
+ if (!this->emitPopPtr(InitExpr))
+ return false;
} else {
// Non-primitive case. Get a pointer to the field-to-initialize
// on the stack and call visitInitialzer() for it.
}
/// 1) Pops the value from the stack
-/// 2) Pops a pointer from the stack
+/// 2) Peeks a pointer from the stack
/// 3) Pushes the value to field I of the pointer on the stack
template <PrimType Name, class T = typename PrimConv<Name>::T>
bool InitField(InterpState &S, CodePtr OpPC, uint32_t I) {
const T &Value = S.Stk.pop<T>();
- const Pointer &Field = S.Stk.pop<Pointer>().atField(I);
+ const Pointer &Field = S.Stk.peek<Pointer>().atField(I);
Field.deref<T>() = Value;
Field.activate();
Field.initialize();