Changeset 61 for branches/Syntetizer/USyntetizer.pas
- Timestamp:
- Oct 14, 2010, 2:30:40 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Syntetizer/USyntetizer.pas
r33 r61 6 6 7 7 uses 8 Classes, SysUtils ;8 Classes, SysUtils, Contnrs; 9 9 10 10 type … … 29 29 30 30 TBeginEnd = class(TCommand) 31 Commands: T List; // TList<ICommand>31 Commands: TObjectList; // TObjectList<ICommand> 32 32 LastEnd: Boolean; 33 33 procedure Syntetize(Syntetizer: TSyntetizer); override; … … 43 43 44 44 TVariableSection = class(TInterfacedObject, ISyntetizable) 45 Variables: T List; // TList<TVariableDeclaration>45 Variables: TObjectList; // TObjectList<TVariableDeclaration> 46 46 procedure Syntetize(Syntetizer: TSyntetizer); 47 47 constructor Create; … … 51 51 TProcedure = class(TInterfacedObject, ISyntetizable) 52 52 Name: string; 53 Parameters: T List;53 Parameters: TObjectList; 54 54 Code: TBeginEnd; 55 55 constructor Create; … … 59 59 60 60 TProcedureList = class(TInterfacedObject, ISyntetizable) 61 Procedures: T List; // TList<TProcedure>61 Procedures: TObjectList; // TObjectList<TProcedure> 62 62 procedure Syntetize(Syntetizer: TSyntetizer); 63 63 constructor Create; … … 76 76 TProcedureCall = class(TCommand) 77 77 Name: string; 78 Parameters: T List; // TList<TProcedureParameter>78 Parameters: TObjectList; // TObjectList<TProcedureParameter> 79 79 constructor Create; 80 80 destructor Destroy; override; … … 84 84 TProgram = class(TInterfacedObject, ISyntetizable) 85 85 Name: string; 86 Code: TBegin end;87 CompilerDirectives: T List; // TList<TCompilerDirective>86 Code: TBeginEnd; 87 CompilerDirectives: TObjectList; // TList<TCompilerDirective> 88 88 Procedures: TProcedureList; // TList<TProcedure> 89 89 Variables: TVariableSection; … … 154 154 constructor TProgram.Create; 155 155 begin 156 CompilerDirectives := T List.Create;156 CompilerDirectives := TObjectList.Create; 157 157 Variables := TVariableSection.Create; 158 158 Procedures := TProcedureList.Create; … … 162 162 163 163 destructor TProgram.Destroy; 164 var165 I: Integer;166 164 begin 167 165 Procedures.Destroy; 168 166 Variables.Destroy; 169 for I := 0 to CompilerDirectives.Count - 1 do170 TCompilerDirective(CompilerDirectives[I]).Destroy;171 167 Code.Destroy; 168 CompilerDirectives.Destroy; 172 169 inherited Destroy; 173 170 end; … … 192 189 constructor TBeginEnd.Create; 193 190 begin 194 Commands := T List.Create;191 Commands := TObjectList.Create; 195 192 end; 196 193 197 194 destructor TBeginEnd.Destroy; 198 var 199 I: Integer; 200 begin 201 for I := 0 to Commands.Count - 1 do 202 TCommand(Commands[I]).Destroy; 195 begin 203 196 Commands.Destroy; 204 197 inherited Destroy; … … 209 202 constructor TProcedureCall.Create; 210 203 begin 211 Parameters := T List.Create;204 Parameters := TObjectList.Create; 212 205 end; 213 206 214 207 destructor TProcedureCall.Destroy; 215 var 216 I: Integer; 217 begin 218 for I := 0 to Parameters.Count - 1 do 219 TProcedureParameter(Parameters[I]).Destroy; 208 begin 220 209 Parameters.Destroy; 221 210 inherited Destroy; … … 272 261 constructor TVariableSection.Create; 273 262 begin 274 Variables := T List.Create;263 Variables := TObjectList.Create; 275 264 end; 276 265 277 266 destructor TVariableSection.Destroy; 278 var 279 I: Integer; 280 begin 281 for I := 0 to Variables.Count - 1 do 282 TVariableDeclaration(Variables[I]).Destroy; 267 begin 283 268 Variables.Destroy; 284 269 inherited Destroy; … … 289 274 constructor TProcedure.Create; 290 275 begin 291 Parameters := T List.Create;276 Parameters := TObjectList.Create; 292 277 Code := TBeginEnd.Create; 293 278 end; 294 279 295 280 destructor TProcedure.Destroy; 296 var297 I: Integer;298 281 begin 299 282 Code.Destroy; 300 //for I := 0 to Parameters.Count - 1 do301 // TParameter(Parameters[I]).Destroy;302 283 Parameters.Destroy; 303 284 inherited Destroy; … … 309 290 ParameterString: string; 310 291 begin 292 ParameterString := ''; 311 293 with Syntetizer do begin 312 294 for I := 0 to Parameters.Count - 1 do … … 335 317 constructor TProcedureList.Create; 336 318 begin 337 Procedures := T List.Create;319 Procedures := TObjectList.Create; 338 320 end; 339 321 340 322 destructor TProcedureList.Destroy; 341 var 342 I: Integer; 343 begin 344 for I := 0 to Procedures.Count - 1 do 345 TProcedure(Procedures[I]).Destroy; 323 begin 346 324 Procedures.Destroy; 347 325 inherited Destroy;
Note:
See TracChangeset
for help on using the changeset viewer.