Created by @fabiopakk on 2019-07-02 11:17
Last updated on 2019-07-10 11:33
Whenever a macro is expanded in the body of a method, a new Seqn node (AST) is generally created as a placeholder for all statements from the macro. As a result the body of the method is a Seqn containing another Seqn. Worse, in cases of multiply nested macro expansions as in nestedBlocks.sil (in attachment), we can have multiple layers of Seqn composed of Seqn.
A side effect of such nesting can be seen in the transformation framework, particularly when neighbor nodes are used as a context for detecting when to rewrite a statement. For an example, refer to ManyToOneAssert test case in RewriterTest.scala.
Currently, the AST is left as is after nested macro expansions and it is the job of the rewriter framework to tackle nested statements and linearize them prior to rewriting.
This should be reverted: the rewriter framework should be agnostic to macro expansions that might have taken place previously. And the macro expansion should deliver a linearized sequence of statements (Seqn) without unnecessary nesting.
Attachments:
Whenever a macro is expanded in the body of a method, a new Seqn node (AST) is generally created as a placeholder for all statements from the macro. As a result the body of the method is a Seqn containing another Seqn. Worse, in cases of multiply nested macro expansions as in nestedBlocks.sil (in attachment), we can have multiple layers of Seqn composed of Seqn.
A side effect of such nesting can be seen in the transformation framework, particularly when neighbor nodes are used as a context for detecting when to rewrite a statement. For an example, refer to ManyToOneAssert test case in RewriterTest.scala.
Currently, the AST is left as is after nested macro expansions and it is the job of the rewriter framework to tackle nested statements and linearize them prior to rewriting.
This should be reverted: the rewriter framework should be agnostic to macro expansions that might have taken place previously. And the macro expansion should deliver a linearized sequence of statements (Seqn) without unnecessary nesting.
Attachments:
nestedBlocks.sil