@@ -963,14 +963,34 @@ void parseTreeToDCode(T)(ref CodeWriter code, DWriterData data, T tree, immutabl
963963 {
964964 auto codeWrapper = ConditionalCodeWrapper(condition, data);
965965
966- codeWrapper.checkTree(tree.childs, false );
966+ bool shouldDescent (Tree tree)
967+ {
968+ if (tree.nonterminalID == nonterminalIDFor! " IfStatementHead"
969+ && tree.childs[2 ].nodeType == NodeType.merged)
970+ {
971+ auto mdata = &semantic.mergedTreeData(tree.childs[2 ]);
972+ foreach (i, c; tree.childs[2 ].childs)
973+ if (c.nonterminalID == nonterminalIDFor! " Condition"
974+ && ! mdata.conditions[i].isFalse)
975+ return true ;
976+ }
977+ return false ;
978+ }
979+
980+ codeWrapper.checkTree(tree.childs, false , &shouldDescent);
967981
968982 if (codeWrapper.alwaysUseMixin)
969983 {
970984 codeWrapper.begin(code, condition);
971985
972986 void onTree (Tree t, immutable (Formula)* condition2)
973987 {
988+ if (shouldDescent(t))
989+ {
990+ foreach (c; t.childs)
991+ codeWrapper.writeTree(code, &onTree, c, condition2);
992+ return ;
993+ }
974994 parseTreeToDCode(code, data, t, condition2, currentScope);
975995 writeComments(code, data, data.sourceTokenManager.collectTokens(t.location.end));
976996 writeComments(code, data,
0 commit comments