Closed anatoliykmetyuk closed 10 years ago
One thing to consider is how nodes are defined in DSL. Launch anchor is defined as follows:
def _launch_anchor = (child0 : TemplateChildNode ) => T_launch_anchor(child0)
as opposed to other nodes defined as follows
def _normal (cf: => (N_code_normal =>Unit)) = T_code_normal (() => cf)
That is, launch anchor outputs a function, whereas other nodes output templates.
You were right! This was the problematic code at line 1540 of Parsers.scala:
def vmNodeOf (tree: Tree): Tree = tree match { // for @ nodes; these need to know the node type of their operand; very messy...
case (Apply(fun, Function(List(ValDef(_,_, nodeType,_)),block)::_)) => nodeType
case _ => Ident(any_TypeName)
}
I added this nasty line:
case Apply(Select(_, fun_name), _) => vmNodeFor(LPAREN_ASTERISK2) // brutally assuming that fun_name is _launch_anchor
It works; we will have to move all this processing code anyway out of Parser.scala anyway, so a little polution is no big deal.
Consider following script:
In AST view, it will look like follows:
Now instead of
we should have
In case of other nodes, the type of
there
is set correctly, so the issue is only with N_launch_anchor and N_launch (which behaves identically to N_launch_anchor in this case).