Multiple template fragments error

Hello,

I'm switching my generator over from using weaving rules to using reduction rules. When I used weaving rules, I was able to have multiple template fragments in a ClassConcept referenced by my root mapping rule. Now that I've switched to reduction rules, I get an error stating that I have more than one template fragment. Each fragment is the body of separate methods in the class. What is the recommended approach when you need to emit into a class multiple method bodies utilizing the same model fragment for each?

Thanks,

Kevin

0
2 comments

Hi Kevin,

Only weaving rule will allow you to inject multiple fragments into specified positions in output model.

With reduction rule you are replacing input node with output node, and you can neither generate multiple output nodes, nor override output node position. 

Igor.

0

Good news:) In the next MPS public build, reduction templates will be allowed to contain multiple template fragments. There is a limitation though - fragments must be adjacent (have same parent and play same role). Thus, you still won't be able to reduce single node to several method bodies, but reduction to several method declarations (with bodies if you wish) should work.

0

Please sign in to leave a comment.