def __findFirstVarStatement(node):
    """Returns the first var statement of the given node. Ignores inner functions."""
    
    if node.type == "var":
        # Ignore variable blocks which are used as an iterator in for-in loops
        # In this case we return False, so that a new collector "var" is being created
        if getattr(node, "rel", None) == "iterator":
            return False
        else:
            return node
        
    for child in node:
        if child.type == "function":
            continue
        
        result = __findFirstVarStatement(child)
        if result:
            return result
        elif result is False:
            return False
    
    return None