예제 #1
0
 def _cachedCompute(self):
     if not self._isComputed:
         if PyAstUtil.isScopeNode(self._root):
             self.generic_visit(self._root)
             self._isComputed = True
         else:
             raise Exceptions.InternalError(
                 "'%s' called on unsupported node-type (%s)" %
                 (self.__class__.__name__, type(self._root)))
예제 #2
0
 def _cachedCompute(self):
     if not self._isComputed:
         if PyAstUtil.isScopeNode(self._root):
             self.generic_visit(self._root)
             self._isComputed = True
         else:
             raise Exceptions.InternalError(
                     "'%s' called on unsupported node-type (%s)"
                     % (self.__class__.__name__, type(self._root))
                 )
예제 #3
0
def collectPossiblyUninitializedLocalVariables(pyAstNode):
    """Returns the possibly free local variables of the code rooted at `pyAstNode."""
    # Context doesn't play a role below, but we reuse the code for checking `pyAstNode
    if not PyAstUtil.isScopeNode(pyAstNode):
        raise Exceptions.InternalError(
            "Unsupported type of root node in Analysis (%s)" % type(pyAstNode))
    possiblyUninitVisitor = _PossiblyUninitializedScopedVisitor()
    possiblyUninitVisitor.visit(pyAstNode)

    return possiblyUninitVisitor.getPossiblyUninitializedLocalVariables()
def collectPossiblyUninitializedLocalVariables(pyAstNode):
    """Returns the possibly free local variables of the code rooted at `pyAstNode."""
    # Context doesn't play a role below, but we reuse the code for checking `pyAstNode
    if not PyAstUtil.isScopeNode(pyAstNode):
        raise Exceptions.InternalError(
            "Unsupported type of root node in Analysis (%s)"
            % type(pyAstNode))
    possiblyUninitVisitor = _PossiblyUninitializedScopedVisitor()
    possiblyUninitVisitor.visit(pyAstNode)

    return possiblyUninitVisitor.getPossiblyUninitializedLocalVariables()