Question
· Apr 10, 2016

Is it possible to call classmethod of a current class from method generator?

Here's my code (download):

Class Utils.Generators [ Abstract ]
{

ClassMethod B()
{
    s ^a = 1
}

ClassMethod A() [ CodeMode = objectgenerator, GenerateAfter = B, PlaceAfter = B ]
{
    k ^a
    do ..B()
}

Now, obviously for it to work I need method B compiled and ready to use before compiling method A().

I test it with the following code:

do $system.OBJ.UnCompile("Utils.Generator")
do $system.OBJ.Compile("Utils.Generator")

Yet, I receive the following compilation error:

Compilation started on 04/10/2016 18:39:04 with qualifiers ''
Compiling class Utils.Generator
ERROR #5002: Cache error: <CLASS DOES NOT EXIST>A+2^Utils.Generator.G1 *Utils.Generator
  > ERROR #5490: Error running generator for method 'A:Utils.Generator'
ERROR: Utils.Generator.G1.int(A+2) : <CLASS DOES NOT EXIST>
ERROR: Utils.Generator.cls(A) of generated code
    > ERROR #5030: An error occurred while compiling class 'Utils.Generator'
Compiling routine Utils.Generator.1
Detected 1 errors during compilation in 0.006s.

Any way I can solve it (besides moving B method into another class and specifying CompileAfter and DependsOn  class keywords)?

Download code.

Discussion (2)0
Log in or sign up to continue