Anonymous class generation
Hello everybody!
I start working with MPS not long ago, so I still have some difficulties.
The source code ( in model ):
Should be translated into:
and (in another file):
So my question is: how make this unique class names to be equivalent? (i've found "genContext.unique name from...", but its not enough)
Thank you for your attention!
I start working with MPS not long ago, so I still have some difficulties.
The source code ( in model ):
- IInteface i = new IInterface() {// some code //};
Should be translated into:
- IInteface i = new IInterface#some unique extension#();
and (in another file):
- class IInterface#some unique extension# implements IInterface {// some code //}
So my question is: how make this unique class names to be equivalent? (i've found "genContext.unique name from...", but its not enough)
Thank you for your attention!
Please sign in to leave a comment.
I think, the feature you are searching for is mapping labels (see the tutorial and the wiki).
When a generator applies a reduction rule to a node of the source model, it can memorize the node it generated for it. It's like a HashMap "from source model node to generated node". You can look up the generated nodes by using "genContext.get output LABELNAME for (SOURCENODE)".
So in your case:
Cheers
Yann