Changeset 221 for branches/interpreter2/UExecutor.pas
- Timestamp:
- Nov 24, 2020, 6:19:17 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/interpreter2/UExecutor.pas
r214 r221 138 138 destructor TExecutorFunction.Destroy; 139 139 begin 140 Block.Free;141 inherited Destroy;140 FreeAndNil(Block); 141 inherited; 142 142 end; 143 143 … … 151 151 destructor TExecutorVariable.Destroy; 152 152 begin 153 Value.Free;154 inherited Destroy;153 FreeAndNil(Value); 154 inherited; 155 155 end; 156 156 … … 164 164 destructor TExecutorType.Destroy; 165 165 begin 166 F unctions.Free;167 inherited Destroy;166 FreeAndNil(Functions); 167 inherited; 168 168 end; 169 169 … … 273 273 destructor TExecutorBlock.Destroy; 274 274 begin 275 Variables.Free;276 F unctions.Free;277 Types.Free;278 inherited Destroy;275 FreeAndNil(Variables); 276 FreeAndNil(Functions); 277 FreeAndNil(Types); 278 inherited; 279 279 end; 280 280 … … 513 513 var 514 514 Value: TValue; 515 BoolValue: Boolean; 515 516 begin 516 517 while True do begin 517 518 Value := ExecuteExpression(Block, WhileDo.Expression); 518 519 if Value is TValueBoolean then begin 519 if not TValueBoolean(Value).Value then Break; 520 BoolValue := TValueBoolean(Value).Value; 521 Value.Free; 522 if not BoolValue then Break; 520 523 ExecuteCommand(Block, WhileDo.Command); 521 524 if WhileDo.DoContinue then begin … … 528 531 end; 529 532 end else raise Exception.Create('Expected boolean value.'); 530 Value.Free;531 533 end; 532 534 end; … … 537 539 Value: TValue; 538 540 I: Integer; 541 BoolValue: Boolean; 539 542 begin 540 543 while True do begin … … 552 555 Value := ExecuteExpression(Block, RepeatUntil.Expression); 553 556 if Value is TValueBoolean then begin 554 if TValueBoolean(Value).Value then Break; 557 BoolValue := TValueBoolean(Value).Value; 558 Value.Free; 559 if BoolValue then Break; 555 560 end else raise Exception.Create('Expected boolean value.'); 556 Value.Free;557 561 end; 558 562 end; … … 654 658 ExecuteBlock(Block, FunctionCall.FunctionDef.Block, ExecutorFunction.Block); 655 659 ExecutorVariable := ExecutorFunction.Block.Variables.SearchByVariable(TVariable(FunctionCall.FunctionDef.Block.Variables.SearchByName('Result'))); 656 Result := ExecutorVariable.Value ;660 Result := ExecutorVariable.Value.Clone; 657 661 end; 658 662 end else raise Exception.Create('No executor for ' + FunctionCall.FunctionDef.Name + ' function.'); … … 706 710 raise Exception.Create('Missing operator function ' + FuncName + ' for type ' + Expression.TypeRef.Name); 707 711 708 Result := Expression.TypeRef.ValueClass.Create;709 710 712 SetLength(Params, Expression.Items.Count); 711 713 for I := 0 to Expression.Items.Count - 1 do begin
Note:
See TracChangeset
for help on using the changeset viewer.