Changeset 34 for branches/DelphiToC/UPascalSource.pas
- Timestamp:
- Aug 4, 2010, 3:10:20 PM (14 years ago)
- Location:
- branches/DelphiToC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC
- Property svn:ignore
-
old new 5 5 *.dcu 6 6 ProjectGroup1.bdsgroup 7 ParseLog.txt
-
- Property svn:ignore
-
branches/DelphiToC/UPascalSource.pas
r20 r34 5 5 uses 6 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 Dialogs, StdCtrls ;7 Dialogs, StdCtrls, Contnrs; 8 8 9 9 type … … 102 102 TCaseOfEnd = class(TCommand) 103 103 Expression: TExpression; 104 Branches: T List; // TList<TCaseOfEndBranche>104 Branches: TObjectList; // TObjectList<TCaseOfEndBranche> 105 105 ElseCommand: TCommand; 106 constructor Create; 107 destructor Destroy; override; 106 108 end; 107 109 … … 116 118 end; 117 119 118 TCommandList = class(T List)120 TCommandList = class(TObjectList) 119 121 120 122 end; … … 146 148 147 149 TTypeRecord = class 148 Items: T List; // TList<TTypeRecordItem>150 Items: TObjectList; // TObjectList<TTypeRecordItem> 149 151 end; 150 152 … … 154 156 end; 155 157 156 TTypeList = class(T List)158 TTypeList = class(TObjectList) 157 159 Parent: TCommonBlock; 158 160 function Search(Name: string): TType; … … 166 168 end; 167 169 168 TConstantList = class(T List)170 TConstantList = class(TObjectList) 169 171 Parent: TCommonBlock; 170 172 function Search(Name: string): TConstant; … … 178 180 end; 179 181 180 TVariableList = class(T List)182 TVariableList = class(TObjectList) 181 183 Parent: TCommonBlock; 182 184 function Search(Name: string): TVariable; … … 190 192 end; 191 193 192 TParameterList = class(T List)194 TParameterList = class(TObjectList) 193 195 Parent: TFunction; 194 196 function Search(Name: string): TParameter; … … 208 210 end; 209 211 210 TExpressionList = class(T List)212 TExpressionList = class(TObjectList) 211 213 destructor Destroy; override; 212 214 end; … … 221 223 end; 222 224 223 TOperationList = class(T List)225 TOperationList = class(TObjectList) 224 226 destructor Destroy; override; 225 227 end; … … 227 229 TFunction = class(TCommonBlock) 228 230 public 229 Parameters: T List; // TList<TVariable>231 Parameters: TObjectList; // TObjectList<TVariable> 230 232 ResultType: TType; 231 233 constructor Create; override; … … 233 235 end; 234 236 235 TFunctionList = class(T List)237 TFunctionList = class(TObjectList) 236 238 Parent: TCommonBlock; 237 239 function Search(Name: string): TFunction; … … 242 244 public 243 245 ModuleType: TModuleType; 244 UsedModules: T List; // TList<TModule>246 UsedModules: TObjectList; // TObjectList<TModule> 245 247 constructor Create; override; 246 248 procedure Clear; … … 250 252 TProgram = class 251 253 Device: TDevice; 252 Modules: T List; // TList<TModule>254 Modules: TObjectList; // TObjectList<TModule> 253 255 constructor Create; 254 256 destructor Destroy; override; … … 290 292 begin 291 293 Device := TDevice.Create; 292 Modules := T List.Create;294 Modules := TObjectList.Create; 293 295 end; 294 296 295 297 destructor TProgram.Destroy; 296 var 297 I: Integer; 298 begin 299 for I := 0 to Modules.Count - 1 do 300 TModule(Modules[I]).Free; 298 begin 301 299 Modules.Free; 302 300 Device.Free; … … 323 321 I := 0; 324 322 while (I < Count) and (TConstant(Items[I]).Name <> Name) do Inc(I); 325 if I < Count then Result := Items[I]else begin323 if I < Count then Result := TConstant(Items[I]) else begin 326 324 if Assigned(Parent.Parent) then Result := Parent.Parent.Constants.Search(Name) 327 325 else begin … … 344 342 begin 345 343 inherited; 346 UsedModules := T List.Create;344 UsedModules := TObjectList.Create; 347 345 end; 348 346 … … 406 404 I := 0; 407 405 while (I < Count) and (TType(Items[I]).Name <> Name) do Inc(I); 408 if I < Count then Result := Items[I]else begin406 if I < Count then Result := TType(Items[I]) else begin 409 407 if Assigned(Parent.Parent) then Result := Parent.Parent.Types.Search(Name) 410 408 else begin … … 417 415 418 416 destructor TVariableList.Destroy; 419 var 420 I: Integer; 421 begin 422 for I := 0 to Count - 1 do 423 TVariable(Items[I]).Free; 417 begin 424 418 inherited; 425 419 end; … … 431 425 I := 0; 432 426 while (I < Count) and (TVariable(Items[I]).Name <> Name) do Inc(I); 433 if I < Count then Result := Items[I]else begin427 if I < Count then Result := TVariable(Items[I]) else begin 434 428 if Assigned(Parent.Parent) then Result := Parent.Parent.Variables.Search(Name) 435 429 else begin … … 461 455 I := 0; 462 456 while (I < Count) and (TFunction(Items[I]).Name <> Name) do Inc(I); 463 if I < Count then Result := Items[I]else begin457 if I < Count then Result := TFunction(Items[I]) else begin 464 458 if Assigned(Parent.Parent) then Result := Parent.Parent.Methods.Search(Name) 465 459 else begin … … 530 524 I := 0; 531 525 while (I < Count) and (TParameter(Items[I]).Name <> Name) do Inc(I); 532 if I < Count then Result := Items[I] else Result := nil; 526 if I < Count then Result := TParameter(Items[I]) 527 else Result := nil; 533 528 end; 534 529 … … 579 574 end; 580 575 576 { TCaseOfEnd } 577 578 constructor TCaseOfEnd.Create; 579 begin 580 Branches := TObjectList.Create 581 end; 582 583 destructor TCaseOfEnd.Destroy; 584 begin 585 Branches.Destroy; 586 inherited; 587 end; 588 581 589 end. 582 590
Note:
See TracChangeset
for help on using the changeset viewer.