Exemplo n.º 1
0
def addScopeDependentDebug(node):
    for (name, child) in node.children():
        if nodeType(child) == 'For':
            ASTModifier.enterScope()
            addForDebug(node, child, [x[1] for x in node.children()].index(child))
            addScopeDependentDebug(child)
            ASTModifier.exitScope()
        elif nodeType(child) == 'While':
            ASTModifier.enterScope()
            addWhileDebug(node, child, [x[1] for x in node.children()].index(child))
            addScopeDependentDebug(child)
            ASTModifier.exitScope()
        elif nodeType(child) == 'DoWhile':
            ASTModifier.enterScope()
            addWhileDebug(node, child, [x[1] for x in node.children()].index(child))
            addScopeDependentDebug(child)
            ASTModifier.exitScope()
        elif nodeType(child) == 'If':
            ASTModifier.enterScope()
            addIfDebug(node, child, [x[1] for x in node.children()].index(child))
            addScopeDependentDebug(child)
            ASTModifier.exitScope()
        elif nodeType(node) == 'Compound' and nodeType(child) == 'Decl':
            addDeclDebug(node, child)
            addScopeDependentDebug(child)
        elif nodeType(node) == 'Compound' and nodeType(child) == 'Assignment' and nodeType(child.lvalue) == 'ID':
            addAssignDebug(node, child)
            addScopeDependentDebug(child)
        elif nodeType(node) == 'Compound' and (nodeType(child) == 'UnaryOp' and nodeType(child.expr) == 'ID' and
                (child.op == 'p++' or child.op == '++' or
                 child.op == 'p--' or child.op == '--')):
            addUnopDebug(node, child)
            addScopeDependentDebug(child)
        else:
            addScopeDependentDebug(child)