Recent

Author Topic: Invokeable Variant with named arg (Continued but expanded)  (Read 331 times)

stjcottbus

  • New member
  • *
  • Posts: 7
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


PascalDragon

  • Hero Member
  • *****
  • Posts: 562
  • Compiler Developer
Re: Invokeable Variant with named arg (Continued but expanded)
« Reply #1 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.

stjcottbus

  • New member
  • *
  • Posts: 7
Re: Invokeable Variant with named arg (Continued but expanded)
« Reply #2 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

stjcottbus

  • New member
  • *
  • Posts: 7
Re: Invokeable Variant with named arg (Continued but expanded)
« Reply #3 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