Ignore:
Timestamp:
Apr 22, 2020, 10:23:31 PM (5 years ago)
Author:
chronos
Message:
  • Added: Transformation of Result variable assignment into Return statement.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/interpreter2/Forms/UFormMain.pas

    r211 r213  
    77uses
    88  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Menus,
    9   ActnList, ExtCtrls, SynHighlighterPas, SynEdit, USource;
     9  ActnList, ExtCtrls, SynHighlighterPas, SynEdit, USource, UOptimizer;
    1010
    1111type
     
    1616    ACompile: TAction;
    1717    AGenerateXml: TAction;
    18     AOptimize: TAction;
    1918    AExit: TAction;
    2019    ARun: TAction;
     
    4443    procedure AGeneratePhpExecute(Sender: TObject);
    4544    procedure AGenerateXmlExecute(Sender: TObject);
    46     procedure AOptimizeExecute(Sender: TObject);
     45    procedure Optimize(Features: TOptimizeFeatures);
    4746    procedure ARunExecute(Sender: TObject);
    4847    procedure FormActivate(Sender: TObject);
     
    7170uses
    7271  UParser, UExecutor, UGeneratorPascal, UGeneratorPhp, UFormMessages, UFormSource,
    73   UGeneratorCSharp, UOptimizer, UGeneratorXml, UFormOutput;
     72  UGeneratorCSharp, UGeneratorXml, UFormOutput;
    7473
    7574{ TFormMain }
     
    127126begin
    128127  ACompile.Execute;
    129   AOptimize.Execute;
     128  Optimize([ofReplaceResultByReturn, ofReplaceRepeatUntilByWhileDo]);
    130129  FormOutput.SynEditOutput.Highlighter := FormOutput.SynCppSyn1;
    131130  FormOutput.Clear;
     
    145144begin
    146145  ACompile.Execute;
    147   AOptimize.Execute;
    148146  FormOutput.SynEditOutput.Highlighter := FormOutput.SynPasSyn1;
    149147  FormOutput.SynEditOutput.Lines.Clear;
     
    163161begin
    164162  ACompile.Execute;
     163  Optimize([ofReplaceResultByReturn, ofReplaceRepeatUntilByWhileDo]);
    165164  FormOutput.SynEditOutput.Highlighter := FormOutput.SynPhpSyn1;
    166165  FormOutput.SynEditOutput.Lines.Clear;
     
    192191end;
    193192
    194 procedure TFormMain.AOptimizeExecute(Sender: TObject);
     193procedure TFormMain.Optimize(Features: TOptimizeFeatures);
    195194var
    196195  Optimizer: TOptimizer;
     
    198197  if Assigned(Prog) then begin
    199198    Optimizer := TOptimizer.Create;
     199    Optimizer.Features := Features;
    200200    Optimizer.Prog := Prog;
    201201    Optimizer.Optimize;
     
    209209begin
    210210  ACompile.Execute;
    211   AOptimize.Execute;
    212211  FormOutput.SynEditOutput.Highlighter := nil;
    213212  FormOutput.SynEditOutput.Lines.Clear;
Note: See TracChangeset for help on using the changeset viewer.