Changeset 235 for branches/xpascal/Generators/GeneratorPascal.pas
- Timestamp:
- Jun 27, 2023, 10:09:21 AM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/xpascal/Generators/GeneratorPascal.pas
r234 r235 102 102 Indent := Indent + 1; 103 103 for I := 0 to RepeatUntil.Commands.Count - 1 do begin 104 GenerateCommand(Block, TCommand(RepeatUntil.Commands[I]));104 GenerateCommand(Block, RepeatUntil.Commands[I]); 105 105 AddTextLine(';'); 106 106 end; … … 119 119 AddText('('); 120 120 for I := 0 to FunctionCall.Params.Count - 1 do 121 GenerateExpression(Block, TExpression(FunctionCall.Params[I]));121 GenerateExpression(Block, FunctionCall.Params[I]); 122 122 AddText(')'); 123 123 end; … … 133 133 AddText('('); 134 134 for I := 0 to ProcedureCall.Params.Count - 1 do 135 GenerateExpression(Block, TExpression(ProcedureCall.Params[I]));135 GenerateExpression(Block, ProcedureCall.Params[I]); 136 136 AddText(')'); 137 137 end; … … 169 169 AddText(' '); 170 170 end; 171 GenerateExpression(Block, TExpression(Expression.Items[I]));171 GenerateExpression(Block, Expression.Items[I]); 172 172 end; 173 173 end; … … 217 217 if Prog.Name <> '' then AddTextLine('program ' + Prog.Name + ';'); 218 218 AddTextLine('{$mode delphi}'); 219 AddTextLine(''); 219 220 AddTextLine('uses SysUtils;'); 220 221 GenerateBlock(Block, Prog.Block); … … 231 232 AddText('('); 232 233 for I := 0 to FunctionDef.Params.Count - 1 do begin 233 AddText( TFunctionParameter(FunctionDef.Params[I]).Name);234 AddText(FunctionDef.Params[I].Name); 234 235 AddText(': '); 235 AddText( TFunctionParameter(FunctionDef.Params[I]).TypeRef.Name);236 AddText(FunctionDef.Params[I].TypeRef.Name); 236 237 if I > 0 then AddText(', '); 237 238 end; … … 267 268 AddText('('); 268 269 for I := 0 to ProcedureDef.Params.Count - 1 do begin 269 AddText( TFunctionParameter(ProcedureDef.Params[I]).Name);270 AddText(ProcedureDef.Params[I].Name); 270 271 AddText(': '); 271 AddText( TFunctionParameter(ProcedureDef.Params[I]).TypeRef.Name);272 AddText(ProcedureDef.Params[I].TypeRef.Name); 272 273 if I > 0 then AddText(', '); 273 274 end; … … 307 308 VarCount := 0; 308 309 for I := 0 to Block.Variables.Count - 1 do 309 if not TVariable(Block.Variables[I]).Internal then Inc(VarCount);310 if not Block.Variables[I].Internal then Inc(VarCount); 310 311 311 312 if VarCount > 0 then begin … … 313 314 Indent := Indent + 1; 314 315 for I := 0 to Block.Variables.Count - 1 do 315 if not TVariable(Block.Variables[I]).Internal then begin316 Variable := TVariable(Block.Variables[I]);316 if not Block.Variables[I].Internal then begin 317 Variable := Block.Variables[I]; 317 318 AddTextLine(Variable.Name + ': ' + Variable.TypeRef.Name + ';'); 318 319 end; … … 331 332 Indent := Indent + 1; 332 333 for I := 0 to Block.Constants.Count - 1 do begin 333 Constant := TConstant(Block.Constants[I]);334 Constant := Block.Constants[I]; 334 335 AddText(Constant.Name + ': ' + Constant.TypeRef.Name + ' = '); 335 336 GenerateValue(Constant.Value); … … 348 349 Indent := Indent + 1; 349 350 for I := 0 to BeginEnd.Commands.Count - 1 do begin 350 GenerateCommand(Block, TCommand(BeginEnd.Commands[I]));351 GenerateCommand(Block, BeginEnd.Commands[I]); 351 352 AddTextLine(';'); 352 353 end; … … 361 362 begin 362 363 for I := 0 to Block.Functions.Count - 1 do begin 363 GenerateFunction(ParentBlock, TFunction(Block.Functions[I]));364 GenerateFunction(ParentBlock, Block.Functions[I]); 364 365 AddTextLine; 365 366 end; … … 372 373 begin 373 374 for I := 0 to Block.Procedures.Count - 1 do begin 374 GenerateProcedure(ParentBlock, TProcedure(Block.Procedures[I]));375 GenerateProcedure(ParentBlock, Block.Procedures[I]); 375 376 AddTextLine; 376 377 end;
Note:
See TracChangeset
for help on using the changeset viewer.