'Try to resolve the given expression to a variable namespace.
"expr" is some kind of ast.Node instance.
Returns the following 2-tuple for the object:
(<variable dict>, <CITDL string>)
where,
<variable dict> is the defining dict for the variable, e.g.
{\'name\': \'classvar\', \'types\': {\'int\': 1}}.
This is None if the variable could not be resolved.
<CITDL string> is a string of CITDL code (see the spec) describing
how to resolve the variable later. This is None if the
variable could be resolved or if the expression is not
expressible in CITDL (CITDL does not attempt to be a panacea).'

def _resolveObjectRef(self, expr):

    log.debug('_resolveObjectRef(expr=%r)', expr)
    if isinstance(expr, ast.Name):
        name = expr.name
        nspath = self.nsstack[(-1)]['nspath']
        for i in range(len(nspath), (-1), (-1)):
            ns = self.st[nspath[:i]]
            if (name in ns['symbols']):
                return (ns['symbols'][name], None)
            else:
                log.debug('_resolveObjectRef:    %r    not    in    namespace    %r', name, '.'.join(ns['nspath']))
    elif isinstance(expr, ast.Getattr):
        (obj, citdl) = self._resolveObjectRef(expr.expr)
        decl = ((obj and obj['declaration']) or None)
        if (decl and (expr.attrname in decl['symbols'])):
            return (decl['symbols'][expr.attrname], None)
        elif isinstance(expr.expr, ast.Const):
            citdl = ('__builtins__.%s.%s' % (type(expr.expr.value).__name__, expr.attrname))
            return (None, citdl)
    elif isinstance(expr, ast.Const):
        return (None, ('__builtins__.%s' % type(expr.value).__name__))
    elif isinstance(expr, ast.CallFunc):
        pass
    log.debug('_resolveObjectRef:    could    not    resolve    %r', expr)
    scope = '.'.join(self.nsstack[(-1)]['nspath'])
    exprrepr = self._getCITDLExprRepr(expr)
    if exprrepr:
        if scope:
            citdl = ('%s    %s' % (exprrepr, scope))
        else:
            citdl = exprrepr
    else:
        citdl = None
    return (None, citdl)
