Question
· Jul 2

How to call another method in a generated method

I have a class with two methods

Class Foo.Bar
{

ClassMethod Helper()
{
// do something
}

ClassMethod Generated() [ CodeMode = objectgenerator ]
{
do ..Helper()
// do something else
}

}

Since the method Generated is run before the class is compiled, the call to do ..Helper() fails. Is there a way around this other than manual inlining?

Product version: IRIS 2023.1
$ZV: IRIS for UNIX (Apple macOS for Apple Silicon) 2023.1.3 (Build 517U) Wed Jan 10 2024 13:24:56 EST
Discussion (3)3
Log in or sign up to continue

The only way I can think of doing this would be to split out the Helper() ClassMethod into its own class, and then ensure the order of compilation is in such a way that the class containing the Helper class method is compiled. Depending on how you're achieving this, could you use the CompileAfter class keyword?

So something like:

Class 1:

Class Foo.Bar.1
{

ClassMethod Helper()
{
// do something
}

}

Class 2:

Class Foo.Bar.2 [ CompileAfter = (Foo.Bar.1) ]
{

ClassMethod Generated() [ CodeMode = objectgenerator ]
{
do ##Class(Foo.Bar.1).Helper()
// do something else
}

}