Project

General

Profile

« Previous | Next » 

Revision 4305

xml_func.py: simplify(): Removed no longer needed pass-through optimizations for XML functions, which are now handled by each function's own simplifying function

View differences:

lib/xml_func.py
94 94
    if len(children) == 1: xml_dom.replace(node, children[0][1])
95 95

  
96 96
def simplify(node):
97
    '''Simplifies the XML functions in an XML tree.
97
    '''Simplifies an XML tree.
98 98
    * Merges nodes tagged as mergable
99 99
    * Runs simplifying functions
100
    * Applies pass-through optimizations for XML functions
101 100
    '''
102 101
    for child in xml_dom.NodeElemIter(node): simplify(child)
103 102
    merge_tagged(node)
......
107 106
    # Pass-through optimizations
108 107
    if is_func_name(name):
109 108
        try: func = simplifying_funcs[name]
110
        except KeyError:
111
            children = list(xml_dom.NodeElemIter(node))
112
            if len(children) == 1: # single arg function
113
                func = name
114
                param_node = children[0]
115
                param = param_node.tagName
116
                value = param_node.firstChild
117
                
118
                is_agg_func = param.isdigit() or func == '_name'
119
                if is_agg_func: passthru(node)
109
        except KeyError: pass
120 110
        else: func(node)
121 111
    # Pruning optimizations
122 112
    else: # these should not run on functions because they would remove args

Also available in: Unified diff