def find_declaration(self, declaration: ASTDeclaration, typ: str, templateShorthand: bool, matchSelf: bool, recurseInAnon: bool) -> 'Symbol':
    if Symbol.debug_lookup:
        Symbol.debug_indent += 1
        Symbol.debug_print('find_declaration:')
    nestedName = declaration.name
    if declaration.templatePrefix:
        templateDecls = declaration.templatePrefix.templates
    else:
        templateDecls = []

    def onMissingQualifiedSymbol(parentSymbol: 'Symbol', identOrOp: Union[(ASTIdentifier, ASTOperator)], templateParams: Any, templateArgs: ASTTemplateArgs) -> 'Symbol':
        return None
    lookupResult = self._symbol_lookup(nestedName, templateDecls, onMissingQualifiedSymbol, strictTemplateParamArgLists=False, ancestorLookupType=typ, templateShorthand=templateShorthand, matchSelf=matchSelf, recurseInAnon=recurseInAnon, correctPrimaryTemplateArgs=False, searchInSiblings=False)
    if Symbol.debug_lookup:
        Symbol.debug_indent -= 1
    if (lookupResult is None):
        return None
    symbols = list(lookupResult.symbols)
    if (len(symbols) == 0):
        return None
    querySymbol = Symbol(parent=lookupResult.parentSymbol, identOrOp=lookupResult.identOrOp, templateParams=lookupResult.templateParams, templateArgs=lookupResult.templateArgs, declaration=declaration, docname='fakeDocnameForQuery')
    queryId = declaration.get_newest_id()
    for symbol in symbols:
        if (symbol.declaration is None):
            continue
        candId = symbol.declaration.get_newest_id()
        if (candId == queryId):
            querySymbol.remove()
            return symbol
    querySymbol.remove()
    return None
def find_declaration(self, declaration: ASTDeclaration, typ: str, templateShorthand: bool, matchSelf: bool, recurseInAnon: bool) -> 'Symbol':
    if Symbol.debug_lookup:
        Symbol.debug_indent += 1
        Symbol.debug_print('find_declaration:')
    nestedName = declaration.name
    if declaration.templatePrefix:
        templateDecls = declaration.templatePrefix.templates
    else:
        templateDecls = []

    def onMissingQualifiedSymbol(parentSymbol: 'Symbol', identOrOp: Union[(ASTIdentifier, ASTOperator)], templateParams: Any, templateArgs: ASTTemplateArgs) -> 'Symbol':
        return None
    lookupResult = self._symbol_lookup(nestedName, templateDecls, onMissingQualifiedSymbol, strictTemplateParamArgLists=False, ancestorLookupType=typ, templateShorthand=templateShorthand, matchSelf=matchSelf, recurseInAnon=recurseInAnon, correctPrimaryTemplateArgs=False, searchInSiblings=False)
    if Symbol.debug_lookup:
        Symbol.debug_indent -= 1
    if (lookupResult is None):
        return None
    symbols = list(lookupResult.symbols)
    if (len(symbols) == 0):
        return None
    querySymbol = Symbol(parent=lookupResult.parentSymbol, identOrOp=lookupResult.identOrOp, templateParams=lookupResult.templateParams, templateArgs=lookupResult.templateArgs, declaration=declaration, docname='fakeDocnameForQuery')
    queryId = declaration.get_newest_id()
    for symbol in symbols:
        if (symbol.declaration is None):
            continue
        candId = symbol.declaration.get_newest_id()
        if (candId == queryId):
            querySymbol.remove()
            return symbol
    querySymbol.remove()
    return None