Changeset 230 for branches/xpascal/Generators/GeneratorCSharp.pas
- Timestamp:
- Jun 26, 2023, 12:08:45 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/xpascal/Generators/GeneratorCSharp.pas
r224 r230 129 129 if FunctionCall.Params.Count > 0 then begin 130 130 AddText('('); 131 for I := 0 to FunctionCall.Params.Count - 1 do 131 for I := 0 to FunctionCall.Params.Count - 1 do begin 132 if FunctionCall.FunctionDef.Params[I].Kind = pkVar then 133 AddText('ref '); 132 134 GenerateExpression(Block, TExpression(FunctionCall.Params[I])); 135 end; 133 136 AddText(')'); 134 137 end; … … 297 300 var 298 301 I: Integer; 302 Param: TFunctionParameter; 299 303 begin 300 304 GenerateTypeRef(FunctionDef.ResultType); 301 305 AddText(' ' + FunctionDef.Name + '('); 302 306 for I := 0 to FunctionDef.Params.Count - 1 do begin 303 GenerateTypeRef(TFunctionParameter(FunctionDef.Params[I]).TypeRef); 307 Param := TFunctionParameter(FunctionDef.Params[I]); 308 if Param.Kind = pkVar then AddText('ref '); 309 GenerateTypeRef(Param.TypeRef); 304 310 AddText(' '); 305 AddText( TFunctionParameter(FunctionDef.Params[I]).Name);311 AddText(Param.Name); 306 312 if I > 0 then AddText(', '); 307 313 end; … … 312 318 if FunctionDef.InternalName = 'WriteLn' then AddTextLine('Console.Write(Text + "\n");') 313 319 else if FunctionDef.InternalName = 'Write' then AddTextLine('Console.Write(Text);') 320 else if FunctionDef.InternalName = 'ReadLn' then AddTextLine('Text = Console.ReadLine();') 321 else if FunctionDef.InternalName = 'Read' then AddTextLine('Text = Console.ReadLine();') 314 322 else if FunctionDef.InternalName = 'IntToStr' then AddTextLine('return Value.ToString();') 315 323 else if FunctionDef.InternalName = 'StrToInt' then begin … … 319 327 AddTextLine(' return x;'); 320 328 AddTextLine('} else return 0;'); 329 end 330 else if FunctionDef.InternalName = 'BoolToStr' then AddTextLine('return Value.ToString();') 331 else if FunctionDef.InternalName = 'StrToBool' then begin 332 AddTextLine('bool x = false;'); 333 AddTextLine('if (bool.TryParse(Value, out x))'); 334 AddTextLine('{'); 335 AddTextLine(' return x;'); 336 AddTextLine('} else return false;'); 321 337 end; 322 338
Note:
See TracChangeset
for help on using the changeset viewer.