Fixed closure upvalue scoping
This commit is contained in:
@@ -281,18 +281,13 @@ begin
|
||||
end;
|
||||
|
||||
procedure TExecutionScope.DefineBoxed(const Address: TResolvedAddress; const Value: TDataValue);
|
||||
var
|
||||
targetScope: TExecutionScope;
|
||||
i: Integer;
|
||||
begin
|
||||
// This method is only for local variables (ScopeDepth=0).
|
||||
Assert(Address.ScopeDepth = 0, 'DefineBoxed can only be used on the current scope.');
|
||||
targetScope := Self;
|
||||
Assert((Address.SlotIndex >= 0) and (Address.SlotIndex < Length(FValues)), 'Invalid slot index during DefineBoxed.');
|
||||
|
||||
Assert((Address.SlotIndex >= 0) and (Address.SlotIndex < Length(targetScope.FValues)), 'Invalid slot index during DefineBoxed.');
|
||||
|
||||
targetScope.FValues[Address.SlotIndex].Value := TDataValue.FromIntf<IValueCell>(TValueCell.Create(Value));
|
||||
targetScope.FValues[Address.SlotIndex].IsBoxed := True;
|
||||
FValues[Address.SlotIndex].Value := TDataValue.FromIntf<IValueCell>(TValueCell.Create(Value));
|
||||
FValues[Address.SlotIndex].IsBoxed := True;
|
||||
end;
|
||||
|
||||
procedure TExecutionScope.DumpScope(const ABuilder: TStringBuilder; AIndent: Integer);
|
||||
|
||||
Reference in New Issue
Block a user