Lazarus

Free Pascal => General => Topic started by: stjcottbus on May 07, 2019, 04:53:25 pm

Title: Invokeable Variant with named arg (Continued but expanded)
Post by: stjcottbus on May 07, 2019, 04:53:25 pm
Hi all.

I was asking about named arguments and to detect the corresponding name/value in
https://forum.lazarus.freepascal.org/index.php/topic,45300.msg320198.html#msg320 some days ago and thougt this is solved but ...

If I've something like

V := VarTest.Method(1, ArgX := 2, 3, ArgY := 4, 5)

which is totally legal

I got 5 arguments with 2 named arguments. So far so good.

In DispInvoke I'll find all values (reversed which is no problem) in the given Params and
the arg names (ArgX,ArgY) behind the "Method" in CallDesc^.ArgTypes.

But I do not see a way to correctly map the values to the named args. There should be any hint
which value belongs to a named arg and which one to a positional arg.

Am I blind and miss something?

Stephan

Title: Re: Invokeable Variant with named arg (Continued but expanded)
Post by: PascalDragon on May 11, 2019, 03:54:48 pm
Am I blind and miss something?
I checked with Delphi (cause this is essentially a Delphi/Windows compatible feature) and it's a bug in FPC that this compiles. Positional arguments must be before named arguments.
Title: Re: Invokeable Variant with named arg (Continued but expanded)
Post by: stjcottbus on May 16, 2019, 01:47:11 pm
I checked with Delphi (cause this is essentially a Delphi/Windows compatible feature) and it's a bug in FPC that this compiles. Positional arguments must be before named arguments.

Thanks for the check.
I'll file a bug report.
Stephan
Title: Re: Invokeable Variant with named arg (Continued but expanded)
Post by: stjcottbus on May 16, 2019, 01:59:08 pm
I checked with Delphi (cause this is essentially a Delphi/Windows compatible feature) and it's a bug in FPC that this compiles. Positional arguments must be before named arguments.

Thanks for the check.
I'll file a bug report.
Stephan

Done:
https://bugs.freepascal.org/view.php?id=35591