Пример #1
0
 foreach (Symbol *symbol, symbols) {
     LookupItem item;
     item.setType(symbol->type());
     item.setScope(symbol->enclosingScope());
     item.setDeclaration(symbol);
     _results.append(item);
 }
Пример #2
0
 /// Return all typedefs with given name from given scope up to function scope.
 static QList<LookupItem> typedefsFromScopeUpToFunctionScope(const Name *name, Scope *scope)
 {
     QList<LookupItem> results;
     if (!scope)
         return results;
     Scope *enclosingBlockScope = 0;
     for (Block *block = scope->asBlock(); block;
          block = enclosingBlockScope ? enclosingBlockScope->asBlock() : 0) {
         const unsigned memberCount = block->memberCount();
         for (unsigned i = 0; i < memberCount; ++i) {
             Symbol *symbol = block->memberAt(i);
             if (Declaration *declaration = symbol->asDeclaration()) {
                 if (isTypedefWithName(declaration, name)) {
                     LookupItem item;
                     item.setDeclaration(declaration);
                     item.setScope(block);
                     item.setType(declaration->type());
                     results.append(item);
                 }
             }
         }
         enclosingBlockScope = block->enclosingScope();
     }
     return results;
 }