Can't resolve classifier Follow
Hey there..
we trying to build a generator, which should instanciate a class, but this dosn't work. we choose in the list and selects our class, but when generating the code it says, "Couldn't resolve template reference 'classifier' " ...
also when trying to build a constructor, we are having difficulties. We can not give the constructor a name. ?!
is the Integer.constant implementet yet.. because when we try selecting it, nothing happens?
Thanks in advance
/Svarrer
Please sign in to leave a comment.
Hi,
Constructor names in b234 are not shown correctly. It is bug.
Are you trying to generate class using mapping rule? Or you are trying to inject constructor into class using weaving rule?
I recommend you to take a look at structure language generator:
- in mps project: go to "modules pool", find node (L) jetbrains.mps.bootstrap.structureLanguage, invoke popup and click "Add To Project";
- in the structure lang generator open mapping config "MAPPING_StructureLanguage_BaseLanguage"
First mapping rule generates class for ConceptDeclaration.
Then, first weaving rule takes PropertyDeclaration and injects field, and 2 methods (getter/setter) into class originated from ConceptDeclaration.
In right part of weaving rule you can see reference to template and query method providing context for template.
If you take a look at the template you will found 3 template fragments (<TF....TF>) which reside inside "context_class". Using context-query-method generator can resolve "abstract" context class and decide where template fragments are to be injected.
In this particular case, PropertyDeclaration is child of ConceptDeclaration.
So the context-query-method do following:
- get parent of property declaration
- find INodeBuilder by mapping name "javaClass" (this mapping name is defined in 1st mapping rule)
Navigation tip: use Ctrl-B to navigate to templates and query methods (don't forget to unpack queries-src.zip to source folder in IDEA project).
Igor.