Project

General

Profile

« Previous | Next » 

Revision 4230

xml_func.py: simplify(): Also remove _if statements with only a condition. This is a required transformation, because such _if statements can't be handled by functions._if() due to there being no argument to provide the anyelement type.

View differences:

lib/xml_func.py
94 94
            value = param_node.firstChild
95 95
            
96 96
            is_agg_func = param.isdigit() or func == '_name'
97
            is_if_no_cond = func = '_if' # no if condition means False
98
            if is_agg_func or (is_if_no_cond and param == 'else'):
97
            if is_agg_func or (func == '_if' and param == 'else'):
99 98
                xml_dom.replace(node, value)
100
            elif is_if_no_cond and param == 'then': xml_dom.remove(node)
99
            elif func == '_if': xml_dom.remove(node) # only a cond or then arg
101 100
    # Pruning optimizations
102 101
    else: # these should not run on functions because they would remove args
103 102
        # Remove empty children

Also available in: Unified diff