Skip to content

Late bound Method call in FoxPro dialect with "compatible array access" does not work #1108

@RobertvanderHulst

Description

@RobertvanderHulst

The compiler translates the following code

LOCAL oVar as USUAL
oVal:SomeName(1)

into the equivalent of
IvarGet(oVal, "SomeName")[1]
and when oVal is not declared into
IVarGet(MemVarGet("oVal"),"SomeName")[1]
when /fox2 is enabled.
However this may also be a method call.

If the parameter is not numeric then it works fine
oVal:SomeName("Foo")
becomes
Send(oVal, "SomeName", "Foo")

We need to add a runtime function that takes care of this. Something like

IVarGetOrSend(oObj as object, cName as string, nIndex as long)
IVarGetOrSend(oObj as object, cName as string, nIndex1 as long, nIndex2 as long)

Inside these function we need to test if cName is a field/property and then output the code that the compiler produces now.
Otherwise if cName is a method then we need to call Send(oVal, cName, nIndex)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions