diff --git a/Src/AST/Myc.Ast.Scope.pas b/Src/AST/Myc.Ast.Scope.pas index 1f263a9..64b5a14 100644 --- a/Src/AST/Myc.Ast.Scope.pas +++ b/Src/AST/Myc.Ast.Scope.pas @@ -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(TValueCell.Create(Value)); - targetScope.FValues[Address.SlotIndex].IsBoxed := True; + FValues[Address.SlotIndex].Value := TDataValue.FromIntf(TValueCell.Create(Value)); + FValues[Address.SlotIndex].IsBoxed := True; end; procedure TExecutionScope.DumpScope(const ABuilder: TStringBuilder; AIndent: Integer);