Strict generation mode failure: bad context for weaving rule: CorkboardState_Protein is generated by 'create root' rule
Hi.
I'm trying to use a weaving rule in a root class template and I'm getting this message.
Could anyone please help explain this?
TIA,
Karol
I'm trying to use a weaving rule in a root class template and I'm getting this message.
Could anyone please help explain this?
TIA,
Karol
Please sign in to leave a comment.
Is this a way to go?
Anyway it gives me an error:
failed to generate output after 10 repeated mappings
to get more diagnostic generate model with the 'save transient models' option
Generation failed for model 'EventLang.sandbox': failed to generate output after 10 repeated mappings.
generation completed with errors in 79 ms
Error executing target jetbrains.mps.lang.core.Generate.generate
Any help appreciated.
Btw, I'm trying to create a little language to alleviate the drudgery of events/listeners in java; quite similar to Property in MPS's java extensions.
Maybe such things already exists?
Could it be forbidden to weave from a class member (the event declaration) to another class member (a class field) ?
Is this [still] true?
Can I even implement something like Property without a weaving rule?
Could that be the real solution and a safe one?
Wouldn't it risk some sort of "race condition" (metaphorically), in the generator, threatening to kill the class member node before it gets its weaving?
The initial error message ("bad context for weaving rule: XXX is generated by 'create root' rule") doesn't really prevent you from using weaving rule. In a strict generation mode, there's a check to ensure input nodes weaving rule is applicable to match output nodes it's applied to. With an output node coming from a 'create new root' rule, there's no input nodes to match, hence the message. IOW, weaving rule is applied to INPUT nodes, and the query with output nodes merely gives a context to insert nodes into, thus no input effectively means no weaving could be applied. If you turn strict mode off, weaving would proceed then.