def resolveNS(resType):
    globalNS = pyscope.getGlobalNS()
    scopeLs = []
    
    ltype = resType
    if ltype:
        while True:
            ltype = ltype.parent
            if not ltype: break
            scopeLs.append(ltype)

    # go from global ns to our namespace
    # if there is not, generate new namespace
    # this functionality is in pyscope module
    scopeLs.reverse()       # from top to bottom
    currScope = globalNS
    
    # walk/generate namespaces
    for scope in scopeLs:
        
        if scope == None:
            pymisc.cfgSet('scopeLs', scopeLs)
            raise Exception('none scope caught')
        
        
        currScope = globalNS.childScope(scope)
        
    return currScope
def resolveNS(resType):
    globalNS = pyscope.getGlobalNS()
    scopeLs = []

    ltype = resType
    if ltype:
        while True:
            ltype = ltype.parent
            if not ltype: break
            scopeLs.append(ltype)

    # go from global ns to our namespace
    # if there is not, generate new namespace
    # this functionality is in pyscope module
    scopeLs.reverse()  # from top to bottom
    currScope = globalNS

    # walk/generate namespaces
    for scope in scopeLs:

        if scope == None:
            pymisc.cfgSet('scopeLs', scopeLs)
            raise Exception('none scope caught')

        currScope = globalNS.childScope(scope)

    return currScope
    def __new__(typ, *args, **kwargs):
        print "typ::", typ
        print "ArGS::", args, kwargs
        if len(args) > 0:
            decl = args[0]
            
        else:
            decl = kwargs['decl']
            
        obj = object.__new__(typ, args, kwargs)
        obj.setTreeNodeInfo(decl) # pre-init

        globNS = pyscope.getGlobalNS()
        return globNS.findChild(obj)
    def __new__(typ, *args, **kwargs):
        print "typ::", typ
        print "ArGS::", args, kwargs
        if len(args) > 0:
            decl = args[0]

        else:
            decl = kwargs['decl']

        obj = object.__new__(typ, args, kwargs)
        obj.setTreeNodeInfo(decl)  # pre-init

        globNS = pyscope.getGlobalNS()
        return globNS.findChild(obj)