Ignore:
Timestamp:
Jun 4, 2024, 12:22:49 AM (6 months ago)
Author:
chronos
Message:
  • Modified: Removed U prefix from unit names.
  • Modified: Updated Common package.
Location:
trunk/Compiler/Modules/Pascal
Files:
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/Modules/Pascal/AnalyzerPascal.pas

    r74 r75  
    1 unit UAnalyzerPascal;
    2 
    3 {$mode delphi}
     1unit AnalyzerPascal;
    42
    53interface
    64
    75uses
    8   Classes, SysUtils, UAnalyzer, USourceCodePascal, Dialogs, USourceConvertor;
     6  Classes, SysUtils, Analyzer, SourceCodePascal, Dialogs, SourceConvertor;
    97
    108type
     
    1614  public
    1715    Parser: TAnalyzer;
    18     function DebugExpressions(List: TListExpression): string;
     16    function DebugExpressions(List: TExpressions): string;
    1917    function ParseFile(Name: string): Boolean;
    2018    function ParseWhileDo(var WhileDo: TWhileDo; SourceCode: TCommonBlock): Boolean;
    2119    function ParseExpression(SourceCode: TExpression): Boolean;
    2220    function ParseExpressionParenthases(SourceCode: TExpression;
    23       Expressions: TListExpression): Boolean;
     21      Expressions: TExpressions): Boolean;
    2422    function ParseExpressionOperator(SourceCode: TExpression;
    25       Expressions: TListExpression): Boolean;
     23      Expressions: TExpressions): Boolean;
    2624    function ParseExpressionRightValue(SourceCode: TExpression;
    27       Expressions: TListExpression): Boolean;
     25      Expressions: TExpressions): Boolean;
    2826    function ParseExpressionFunctionCall(SourceCode: TExpression;
    29       Expressions: TListExpression; var Func: TFunctionCall): Boolean;
    30     function ParseUses(SourceCode: TUsedModuleList; AExported: Boolean): Boolean;
    31     function ParseUsesItem(SourceCode: TUsedModuleList; AExported: Boolean): Boolean;
     27      Expressions: TExpressions; var Func: TFunctionCall): Boolean;
     28    function ParseUses(SourceCode: TUsedModules; AExported: Boolean): Boolean;
     29    function ParseUsesItem(SourceCode: TUsedModules; AExported: Boolean): Boolean;
    3230    function ParseModule(ProgramCode: TProgram): TSourceModule;
    3331    function ParseUnit(var SourceCode: TModuleUnit; ProgramCode: TProgram): Boolean;
     
    4038    function ParseCommand(SourceCode: TCommonBlock): TCommand;
    4139    function ParseBeginEnd(var BeginEnd: TBeginEnd; SourceCode: TCommonBlock): Boolean;
    42     function ParseFunction(SourceCode: TFunctionList; Exported: Boolean = False): Boolean;
     40    function ParseFunction(SourceCode: TFunctions; Exported: Boolean = False): Boolean;
    4341    procedure ParseFunctionParameters(SourceCode: TFunction; ValidateParams: Boolean = False);
    4442    function ParseIfThenElse(var IfThenElse: TIfThenElse; SourceCode: TCommonBlock): Boolean;
     
    4644    function ParseAssigment(var Assignment: TAssignment; SourceCode: TCommonBlock): Boolean;
    4745    function ParseFunctionCall(var Call: TFunctionCall; SourceCode: TCommonBlock): Boolean;
    48     function ParseVariableList(SourceCode: TVariableList; Exported: Boolean = False): Boolean;
    49     procedure ParseVariable(SourceCode: TVariableList; Exported: Boolean = False);
    50     function ParseConstantList(SourceCode: TConstantList; Exported: Boolean = False): Boolean;
    51     function ParseConstant(SourceCode: TConstantList; Exported: Boolean = False): Boolean;
    52     function ParseType(TypeList: TTypeList; var NewType: TType; ExpectName: Boolean = True;
     46    function ParseVariableList(SourceCode: TVariables; Exported: Boolean = False): Boolean;
     47    procedure ParseVariable(SourceCode: TVariables; Exported: Boolean = False);
     48    function ParseConstantList(SourceCode: TConstants; Exported: Boolean = False): Boolean;
     49    function ParseConstant(SourceCode: TConstants; Exported: Boolean = False): Boolean;
     50    function ParseType(TypeList: TTypes; var NewType: TType; ExpectName: Boolean = True;
    5351      AssignSymbol: string = '='; ForwardDeclaration: Boolean = False): Boolean;
    5452    function ParseTypeParameters(var NewType: TType): Boolean;
     
    8684  SNotRecordOrClass = '"%s" not record or class';
    8785
     86
    8887implementation
    8988
    9089{ TAnalyzerPascal }
    9190
    92 function TAnalyzerPascal.DebugExpressions(List: TListExpression): string;
     91function TAnalyzerPascal.DebugExpressions(List: TExpressions): string;
    9392var
    9493  I: Integer;
     
    152151function TAnalyzerPascal.ParseExpression(SourceCode: TExpression): Boolean;
    153152var
    154   Expressions: TListExpression;
     153  Expressions: TExpressions;
    155154  I: Integer;
    156155  II: Integer;
     
    158157(*  with Parser do
    159158  try
    160     Expressions := TListExpression.Create;
     159    Expressions := TExpressions.Create;
    161160    Expressions.Add(TExpression.Create);
    162161    with SourceCode do begin
     
    206205
    207206function TAnalyzerPascal.ParseExpressionParenthases(SourceCode: TExpression;
    208   Expressions: TListExpression): Boolean;
     207  Expressions: TExpressions): Boolean;
    209208var
    210209  NewExpression: TExpression;
     
    230229
    231230function TAnalyzerPascal.ParseExpressionOperator(SourceCode: TExpression;
    232   Expressions: TListExpression): Boolean;
     231  Expressions: TExpressions): Boolean;
    233232begin
    234233  (*if IsOperator(NextToken) then begin
     
    241240
    242241function TAnalyzerPascal.ParseExpressionRightValue(SourceCode: TExpression;
    243   Expressions: TListExpression): Boolean;
     242  Expressions: TExpressions): Boolean;
    244243var
    245244  UseType: TType;
     
    348347    end;
    349348    if Assigned(NewExpression) then begin
    350       TExpression(Expressions.Last).SubItems.Last := NewExpression;
     349      TExpression(Expressions.Last).SubItems[TExpression(Expressions.Last).SubItems.Count - 1] := NewExpression;
    351350      with TExpression(Expressions.Items[Expressions.Add(TExpression.Create)]) do
    352351      begin
    353352        CommonBlock := SourceCode.CommonBlock;
    354         SubItems.First := NewExpression;
     353        SubItems[0] := NewExpression;
    355354      end;
    356355      Result := True;
     
    364363
    365364function TAnalyzerPascal.ParseExpressionFunctionCall(SourceCode: TExpression;
    366   Expressions: TListExpression; var Func: TFunctionCall): Boolean;
     365  Expressions: TExpressions; var Func: TFunctionCall): Boolean;
    367366var
    368367  UseFunction: TFunction;
     
    666665{ TParserParseFunctionList }
    667666
    668 function TAnalyzerPascal.ParseFunction(SourceCode: TFunctionList;
     667function TAnalyzerPascal.ParseFunction(SourceCode: TFunctions;
    669668  Exported: Boolean = False): Boolean;
    670669var
     
    796795        while (NextToken <> ')') and (NextTokenType <> ttEndOfFile) do begin
    797796          // while IsIdentificator(NextCode) do begin
    798           with TParameterList(Parameters) do begin
     797          with TParameters(Parameters) do begin
    799798            VariableName := ReadToken;
    800799            if VariableName = 'var' then begin
     
    948947{ TParserVariableList }
    949948
    950 function TAnalyzerPascal.ParseVariableList(SourceCode: TVariableList; Exported: Boolean = False): Boolean;
     949function TAnalyzerPascal.ParseVariableList(SourceCode: TVariables; Exported: Boolean = False): Boolean;
    951950var
    952951  NewValueType: TType;
     
    968967{ TParserVariable }
    969968
    970 procedure TAnalyzerPascal.ParseVariable(SourceCode: TVariableList; Exported: Boolean = False);
     969procedure TAnalyzerPascal.ParseVariable(SourceCode: TVariables; Exported: Boolean = False);
    971970var
    972971  VariableName: string;
     
    10161015{ TParserConstantList }
    10171016
    1018 function TAnalyzerPascal.ParseConstantList(SourceCode: TConstantList; Exported: Boolean = False): Boolean;
     1017function TAnalyzerPascal.ParseConstantList(SourceCode: TConstants; Exported: Boolean = False): Boolean;
    10191018begin
    10201019  with Parser do
     
    10301029end;
    10311030
    1032 function TAnalyzerPascal.ParseConstant(SourceCode: TConstantList;
     1031function TAnalyzerPascal.ParseConstant(SourceCode: TConstants;
    10331032  Exported: Boolean): Boolean;
    10341033var
     
    10821081{ TParserType }
    10831082
    1084 function TAnalyzerPascal.ParseType(TypeList: TTypeList; var NewType: TType; ExpectName: Boolean = True;
     1083function TAnalyzerPascal.ParseType(TypeList: TTypes; var NewType: TType; ExpectName: Boolean = True;
    10851084  AssignSymbol: string = '='; ForwardDeclaration: Boolean = False): Boolean;
    10861085begin
     
    14711470{ TParserUsedModuleList }
    14721471
    1473 function TAnalyzerPascal.ParseUses(SourceCode: TUsedModuleList; AExported: Boolean): Boolean;
     1472function TAnalyzerPascal.ParseUses(SourceCode: TUsedModules; AExported: Boolean): Boolean;
    14741473var
    14751474  NewUsedModule: TUsedModule;
     
    14881487end;
    14891488
    1490 function TAnalyzerPascal.ParseUsesItem(SourceCode: TUsedModuleList;
     1489function TAnalyzerPascal.ParseUsesItem(SourceCode: TUsedModules;
    14911490  AExported: Boolean): Boolean;
    14921491begin
  • trunk/Compiler/Modules/Pascal/ModulePascal.pas

    r74 r75  
    1 unit UModulePascal;
    2 
    3 {$mode delphi}{$H+}
     1unit ModulePascal;
    42
    53interface
    64
    75uses
    8   Classes, SysUtils, UModularSystem, UAnalyzerPascal;
     6  Classes, SysUtils, ModularSystem, AnalyzerPascal;
    97
    108type
     
    2422
    2523uses
    26   UCompilerAPI;
     24  CompilerAPI;
    2725
    2826{ TModulePascal }
     
    3129begin
    3230  inherited;
    33   Name := 'Pascal';
     31  Identification := 'Pascal';
    3432  Title := 'Pascal';
    3533  Version := '0.1';
     
    3836destructor TModulePascal.Destroy;
    3937begin
    40   inherited Destroy;
     38  inherited;
    4139end;
    4240
  • trunk/Compiler/Modules/Pascal/SourceCodePascal.pas

    r74 r75  
    1 unit USourceCodePascal;
    2 
    3 {$MODE Delphi}
    4 {$MACRO ON}
     1unit SourceCodePascal;
    52
    63interface
    74
    85uses
    9   SysUtils, Variants, Classes, Dialogs, SpecializedList, USourceConvertor;
     6  SysUtils, Variants, Classes, Dialogs, Generics.Collections, SourceConvertor;
    107
    118type
     
    2219
    2320  TCommonBlock = class;
    24   TTypeList = class;
    25   TConstantList = class;
    26   TVariableList = class;
    27   TFunctionList = class;
    28   TListExpression = class;
     21  TTypes = class;
     22  TConstants = class;
     23  TVariables = class;
     24  TFunctions = class;
     25  TExpressions = class;
    2926  TExpression = class;
    3027  TFunction = class;
     
    4037
    4138  TContext = class
    42 
    43   end;
    44 
    45   TCommandList = class;
     39  end;
     40
     41  TCommands = class;
    4642
    4743  TCommand = class
     
    5753  end;
    5854
    59   // TListExpression = TGObjectList<Integer, TExpression>
    60   TListExpression = class(TListObject);
     55  { TExpressions }
     56
     57  TExpressions = class(TObjectList<TExpression>)
     58    procedure Assign(Source: TExpressions);
     59  end;
    6160
    6261  { TFunctionCall }
     
    6463  TFunctionCall = class(TCommand)
    6564    FunctionRef: TFunction;
    66     ParameterExpression: TListExpression;
     65    ParameterExpression: TExpressions;
    6766    constructor Create;
    6867    destructor Destroy; override;
     
    7069
    7170  TBeginEnd = class(TCommand)
    72     Commands: TCommandList;
     71    Commands: TCommands;
    7372    CommonBlock: TCommonBlock;
    7473    procedure Clear;
     
    9089
    9190  TRepeatUntil = class(TCommand)
    92     Block: TCommandList;
     91    Block: TCommands;
    9392    Condition: TExpression;
    9493  end;
     
    120119  end;
    121120
    122   // TListCaseOfEndBranche = TGObjectList<Integer, TCaseOfEndBranche>
    123   TListCaseOfEndBranche = class(TListObject);
     121  TListCaseOfEndBranche = class(TObjectList<TCaseOfEndBranche>);
    124122
    125123  TCaseOfEnd = class(TCommand)
     
    132130
    133131  TTryFinally = class(TCommand)
    134     Block: TCommandList;
    135     FinallyBlock: TCommandList;
     132    Block: TCommands;
     133    FinallyBlock: TCommands;
    136134  end;
    137135
    138136  TTryExcept = class(TCommand)
    139     Block: TCommandList;
    140     ExceptBlock: TCommandList;
    141   end;
    142 
    143   // TCommandList = TGObjectList<Integer, TCommand>
    144   TCommandList = class(TListObject);
     137    Block: TCommands;
     138    ExceptBlock: TCommands;
     139  end;
     140
     141  TCommands = class(TObjectList<TCommand>);
    145142
    146143  TCommonBlockSection = (cbsVariable, cbsType, cbsConstant);
     
    150147    Parent: TCommonBlock;
    151148    ParentModule: TSourceModule;
    152     Constants: TConstantList;
    153     Types: TTypeList;
    154     Variables: TVariableList;
    155     Functions: TFunctionList;
    156     Order: TListObject;
     149    Constants: TConstants;
     150    Types: TTypes;
     151    Variables: TVariables;
     152    Functions: TFunctions;
     153    Order: TObjectList<TObject>;
    157154    Code: TBeginEnd;
    158155    constructor Create; virtual;
     
    166163    ForwardDeclared: Boolean;
    167164    Internal: Boolean;
    168     Parent: TTypeList;
     165    Parent: TTypes;
    169166    Name: string;
    170167    Size: Integer;
     
    172169    Exported: Boolean;
    173170    Visibility: TTypeVisibility;
    174     Parameters: TTypeList;
     171    Parameters: TTypes;
    175172    procedure Assign(Source: TType);
    176173    constructor Create;
     
    178175  end;
    179176
    180   // TListType = TGObjectList<Integer, TType>
    181   TListType = class(TListObject);
    182 
    183   TTypeList = class(TListType)
     177  { TTypes }
     178
     179  TTypes = class(TObjectList<TType>)
    184180    Parent: TCommonBlock;
    185181    function Search(Name: string; Exported: Boolean = False): TType;
    186182    destructor Destroy; override;
     183    function AddNew: TType;
    187184  end;
    188185
     
    214211  end;
    215212
    216   // TListEnumItem = TGObjectList<Integer, TEnumItem>
    217   TListEnumItem = class(TListObject);
     213  TEnumItems = class(TObjectList<TEnumItem>);
    218214
    219215  TTypeEnumeration = class(TType)
    220     Items: TListEnumItem;
     216    Items: TEnumItems;
    221217    constructor Create;
    222218    destructor Destroy; override;
     
    239235  end;
    240236
    241   // TListConstant = TGObjectList<Integer, TConstant>
    242   TListConstant = class(TListObject);
    243 
    244   TConstantList = class(TListConstant)
     237  TConstants = class(TObjectList<TConstant>)
    245238    Parent: TCommonBlock;
    246239    function Search(Name: string): TConstant;
     
    256249  end;
    257250
    258   // TListVariable = TGObjectList<Integer, TVariable>
    259   TListVariable = class(TListObject);
    260 
    261   TVariableList = class(TListVariable)
     251  TVariables = class(TObjectList<TVariable>)
    262252    Parent: TCommonBlock;
    263253    function Search(Name: string; Exported: Boolean = False): TVariable;
     
    268258  end;
    269259
    270   // TListParameter = TGObjectList<Integer, TParameter>
    271   TListParameter = class(TListObject);
    272 
    273   TParameterList = class(TListParameter)
     260  TParameters = class(TObjectList<TParameter>)
    274261    Parent: TFunction;
    275262    function Search(Name: string): TParameter;
     
    288275    Value: TValue;
    289276    OperatorName: string;
    290     SubItems: TListExpression;
     277    SubItems: TExpressions;
    291278    Associated: Boolean;
    292279    Braces: Boolean;
     
    302289    Internal: Boolean;
    303290    FunctionType: TFunctionType;
    304     Parameters: TParameterList;
     291    Parameters: TParameters;
    305292    ResultType: TType;
    306293    Exported: Boolean;
     
    310297  end;
    311298
    312   // TListFunction = TGObjectList<Integer, TFunction>
    313   TListFunction = class(TListObject);
    314 
    315   TFunctionList = class(TListFunction)
     299  { TFunctions }
     300
     301  TFunctions = class(TObjectList<TFunction>)
    316302    Parent: TCommonBlock;
    317303    function Search(Name: string; Exported: Boolean = False): TFunction;
    318304    destructor Destroy; override;
     305    function AddNew: TFunction;
    319306  end;
    320307
     
    326313  end;
    327314
    328   // TListUsedModule = TGObjectList<Integer, TUsedModule>
    329   TListUsedModule = class(TListObject);
    330 
    331   TUsedModuleList = class(TListUsedModule)
     315  TUsedModules = class(TObjectList<TUsedModule>)
    332316    ParentModule: TSourceModule;
    333317  end;
     
    340324    Name: string;
    341325    TargetFile: string;
    342     UsedModules: TUsedModuleList;
     326    UsedModules: TUsedModules;
    343327    Body: TCommonBlock;
    344328    Internal: Boolean;
     
    374358  end;
    375359
    376   // TListModule = TGObjectList<Integer, TModule>
    377   TListModule = class(TListObject);
    378 
    379   { TModuleList }
    380 
    381   TModuleList = class(TListModule)
     360  { TModules }
     361
     362  TModules = class(TObjectList<TSourceModule>)
    382363    function Search(Name: string): TSourceModule;
    383364  end;
     
    387368  TProgram = class(TSource)
    388369    Device: TDevice;
    389     Modules: TModuleList;
     370    Modules: TModules;
    390371    MainModule: TSourceModule;
    391372    procedure Clear;
     
    408389  SAssignmentError = 'Assignment error';
    409390
     391
    410392implementation
    411393
     
    415397begin
    416398  inherited;
    417   Parameters := TParameterList.Create;
     399  Parameters := TParameters.Create;
    418400  Parameters.Parent := Self;
    419401  //ResultType := TType.Create;
     
    422404destructor TFunction.Destroy;
    423405begin
    424   Parameters.Free;
    425 //  ResultType.Free;
     406  FreeAndNil(Parameters);
     407//  FreeAndNil(ResultType);
    426408  inherited;
    427409end;
     
    438420begin
    439421  Device := TDevice.Create;
    440   Modules := TModuleList.Create;
     422  Modules := TModules.Create;
    441423end;
    442424
    443425destructor TProgram.Destroy;
    444426begin
    445   Modules.Free;
    446   Device.Free;
    447 end;
    448 
    449 { TConstant }
    450 
    451 
    452 { TConstantList }
    453 
    454 destructor TConstantList.Destroy;
    455 begin
    456   inherited;
    457 end;
    458 
    459 function TConstantList.Search(Name: string): TConstant;
     427  FreeAndNil(Modules);
     428  FreeAndNil(Device);
     429end;
     430
     431{ TConstants }
     432
     433destructor TConstants.Destroy;
     434begin
     435  inherited;
     436end;
     437
     438function TConstants.Search(Name: string): TConstant;
    460439var
    461440  I: Integer;
     
    476455begin
    477456  inherited;
    478   UsedModules := TUsedModuleList.Create;
     457  UsedModules := TUsedModules.Create;
    479458  UsedModules.ParentModule := Self;
    480459  Body := TCommonBlock.Create;
     
    484463destructor TSourceModule.Destroy;
    485464begin
    486   Body.Free;
    487   UsedModules.Free;
     465  FreeAndNil(Body);
     466  FreeAndNil(UsedModules);
    488467  inherited;
    489468end;
     
    504483constructor TCommonBlock.Create;
    505484begin
    506   Constants := TConstantList.Create;
     485  Constants := TConstants.Create;
    507486  Constants.Parent := Self;
    508   Types := TTypeList.Create;
     487  Types := TTypes.Create;
    509488  Types.Parent := Self;
    510   Variables := TVariableList.Create;
     489  Variables := TVariables.Create;
    511490  Variables.Parent := Self;
    512   Functions := TFunctionList.Create;
     491  Functions := TFunctions.Create;
    513492  Functions.Parent := Self;
    514493  Code := TBeginEnd.Create;
    515494  Code.Parent := Self;
    516495  Code.CommonBlock := Self;
    517   Order := TListObject.Create;
     496  Order := TObjectList<TObject>.Create;
    518497  Order.OwnsObjects := False;
    519498end;
     
    521500destructor TCommonBlock.Destroy;
    522501begin
    523   Constants.Free;
    524   Types.Free;
    525   Variables.Free;
    526   Functions.Free;
    527   Code.Free;
    528   Order.Free;
    529   inherited;
    530 end;
    531 
    532 { TTypeList }
    533 
    534 destructor TTypeList.Destroy;
    535 begin
    536   inherited;
    537 end;
    538 
    539 function TTypeList.Search(Name: string; Exported: Boolean = False): TType;
     502  FreeAndNil(Constants);
     503  FreeAndNil(Types);
     504  FreeAndNil(Variables);
     505  FreeAndNil(Functions);
     506  FreeAndNil(Code);
     507  FreeAndNil(Order);
     508  inherited;
     509end;
     510
     511{ TTypes }
     512
     513destructor TTypes.Destroy;
     514begin
     515  inherited;
     516end;
     517
     518function TTypes.AddNew: TType;
     519begin
     520  Result := TType.Create;
     521  Add(Result);
     522end;
     523
     524function TTypes.Search(Name: string; Exported: Boolean = False): TType;
    540525var
    541526  I: Integer;
     
    557542end;
    558543
    559 { TVariableList }
    560 
    561 destructor TVariableList.Destroy;
    562 begin
    563   inherited;
    564 end;
    565 
    566 function TVariableList.Search(Name: string; Exported: Boolean = False): TVariable;
     544{ TVariables }
     545
     546destructor TVariables.Destroy;
     547begin
     548  inherited;
     549end;
     550
     551function TVariables.Search(Name: string; Exported: Boolean = False): TVariable;
    567552var
    568553  I: Integer;
     
    602587end;
    603588
    604 { TFunctionList }
    605 
    606 destructor TFunctionList.Destroy;
    607 begin
    608   inherited;
    609 end;
    610 
    611 function TFunctionList.Search(Name: string; Exported: Boolean): TFunction;
     589{ TFunctions }
     590
     591destructor TFunctions.Destroy;
     592begin
     593  inherited;
     594end;
     595
     596function TFunctions.AddNew: TFunction;
     597begin
     598  Result := TFunction.Create;
     599  Add(Result);
     600end;
     601
     602function TFunctions.Search(Name: string; Exported: Boolean): TFunction;
    612603var
    613604  I: Integer;
     
    631622constructor TExpression.Create;
    632623begin
    633   SubItems := TListExpression.Create;
     624  SubItems := TExpressions.Create;
    634625  SubItems.Count := 2;
    635626  SubItems.OwnsObjects := False;
     
    638629destructor TExpression.Destroy;
    639630begin
    640   SubItems.Free;
     631  FreeAndNil(SubItems);
    641632  inherited;
    642633end;
     
    654645end;
    655646
    656 { TParameterList }
    657 
    658 destructor TParameterList.Destroy;
    659 begin
    660   inherited;
    661 end;
    662 
    663 function TParameterList.Search(Name: string): TParameter;
     647{ TParameters }
     648
     649destructor TParameters.Destroy;
     650begin
     651  inherited;
     652end;
     653
     654function TParameters.Search(Name: string): TParameter;
    664655var
    665656  I: Integer;
     
    675666procedure TBeginEnd.Clear;
    676667begin
    677 
    678668end;
    679669
     
    681671begin
    682672  inherited;
    683   Commands := TCommandList.Create;
     673  Commands := TCommands.Create;
    684674end;
    685675
    686676destructor TBeginEnd.Destroy;
    687677begin
    688   Commands.Free;
     678  FreeAndNil(Commands);
    689679  inherited;
    690680end;
     
    699689destructor TAssignment.Destroy;
    700690begin
    701   Source.Free;
    702   inherited;
     691  FreeAndNil(Source);
     692  inherited;
     693end;
     694
     695{ TExpressions }
     696
     697procedure TExpressions.Assign(Source: TExpressions);
     698var
     699  I: Integer;
     700begin
     701  while Count > Source.Count do Delete(Count - 1);
     702  while Count < Source.Count do Add(TExpression.Create);
     703  for I := 0 to Count - 1 do
     704    Items[I].Assign(Source[I]);
    703705end;
    704706
     
    713715destructor TWhileDo.Destroy;
    714716begin
    715   Condition.Free;
    716   Command.Free;
     717  FreeAndNil(Condition);
     718  FreeAndNil(Command);
    717719  inherited;
    718720end;
     
    728730destructor TCaseOfEnd.Destroy;
    729731begin
    730   Branches.Free;
     732  FreeAndNil(Branches);
    731733  inherited;
    732734end;
     
    741743destructor TIfThenElse.Destroy;
    742744begin
    743   Condition.Free;
    744   inherited Destroy;
     745  FreeAndNil(Condition);
     746  inherited;
    745747end;
    746748
     
    750752begin
    751753  inherited;
    752   ParameterExpression := TListExpression.Create;
     754  ParameterExpression := TExpressions.Create;
    753755end;
    754756
    755757destructor TFunctionCall.Destroy;
    756758begin
    757   ParameterExpression.Free;
    758   inherited Destroy;
     759  FreeAndNil(ParameterExpression);
     760  inherited;
    759761end;
    760762
     
    770772destructor TForToDo.Destroy;
    771773begin
    772   Start.Free;
    773   Stop.Free;;
    774   inherited Destroy;
     774  FreeAndNil(Start);
     775  FreeAndNil(Stop);
     776  inherited;
    775777end;
    776778
     
    785787destructor TTypeRecord.Destroy;
    786788begin
    787   CommonBlock.Free;
    788   inherited Destroy;
    789 end;
    790 
    791 { TModuleList }
    792 
    793 function TModuleList.Search(Name: string): TSourceModule;
     789  FreeAndNil(CommonBlock);
     790  inherited;
     791end;
     792
     793{ TModules }
     794
     795function TModules.Search(Name: string): TSourceModule;
    794796var
    795797  I: Integer;
     
    820822function TSourceModule.SearchConstant(Name: string; Outside: Boolean): TConstant;
    821823begin
    822 
    823824end;
    824825
     
    864865destructor TModuleProgram.Destroy;
    865866begin
    866   inherited Destroy;
     867  inherited;
    867868end;
    868869
     
    881882destructor TModuleUnit.Destroy;
    882883begin
    883   InititializeSection.Free;
    884   FinalalizeSection.Free;
    885   inherited Destroy;
     884  FreeAndNil(InititializeSection);
     885  FreeAndNil(FinalalizeSection);
     886  inherited;
    886887end;
    887888
     
    891892begin
    892893  inherited;
    893   Items := TListEnumItem.Create;
     894  Items := TEnumItems.Create;
    894895end;
    895896
    896897destructor TTypeEnumeration.Destroy;
    897898begin
    898   Items.Free;
    899   inherited Destroy;
     899  FreeAndNil(Items);
     900  inherited;
    900901end;
    901902
     
    910911destructor TTypeClass.Destroy;
    911912begin
    912   CommonBlock.Free;
    913   inherited Destroy;
     913  FreeAndNil(CommonBlock);
     914  inherited;
    914915end;
    915916
     
    942943constructor TType.Create;
    943944begin
    944   Parameters := TTypeList.Create;
     945  Parameters := TTypes.Create;
    945946  //Parameters.Parent := Parent.Parent;
    946947end;
     
    948949destructor TType.Destroy;
    949950begin
    950   Parameters.Free;
    951   inherited Destroy;
     951  FreeAndNil(Parameters);
     952  inherited;
    952953end;
    953954
Note: See TracChangeset for help on using the changeset viewer.