tools/porting/src/semantic.cpp
changeset 37 758a864f9613
parent 18 2f34d5167611
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   766 }
   766 }
   767 
   767 
   768 void Semantic::parseTypeSpecifier(TypeSpecifierAST *ast)
   768 void Semantic::parseTypeSpecifier(TypeSpecifierAST *ast)
   769 {
   769 {
   770     // If this is a classSpecifier or a EnumSpecifier we skip the name lookup,
   770     // If this is a classSpecifier or a EnumSpecifier we skip the name lookup,
   771     // becuase looking up the name "E" in a class definition like
   771     // because looking up the name "E" in a class definition like
   772     // "class E { ..." makes no sense. (There might be a variable named E
   772     // "class E { ..." makes no sense. (There might be a variable named E
   773     // already declared, but that variable is now shadowed by the class type.)
   773     // already declared, but that variable is now shadowed by the class type.)
   774     if(   ast->nodeType() != NodeType_EnumSpecifier
   774     if(   ast->nodeType() != NodeType_EnumSpecifier
   775        && ast->nodeType() != NodeType_ClassSpecifier
   775        && ast->nodeType() != NodeType_ClassSpecifier
   776        && ast->nodeType() != NodeType_ElaboratedTypeSpecifier )
   776        && ast->nodeType() != NodeType_ElaboratedTypeSpecifier )
   805     createNameUse(member, name);
   805     createNameUse(member, name);
   806 }
   806 }
   807 
   807 
   808 /*
   808 /*
   809     looks up name used in basescope. If name->isGlobal() is true or if classOrNamespaceList()
   809     looks up name used in basescope. If name->isGlobal() is true or if classOrNamespaceList()
   810     returns a non-emty list, the C++ qualified name lookup rules are used. Otherwise the
   810     returns a non-empty list, the C++ qualified name lookup rules are used. Otherwise the
   811     unquialified name lookup rules are used.  Returns the a list of members that was found,
   811     unquialified name lookup rules are used.  Returns the a list of members that was found,
   812     In most cases this list will contain zero or one element, exept in the case of overloaded functions.
   812     In most cases this list will contain zero or one element, exept in the case of overloaded functions.
   813     TODO: Argument-dependent name lookup
   813     TODO: Argument-dependent name lookup
   814 */
   814 */
   815 QList<CodeModel::Member *> Semantic::nameLookup(CodeModel::Scope *baseScope, const NameAST* name)
   815 QList<CodeModel::Member *> Semantic::nameLookup(CodeModel::Scope *baseScope, const NameAST* name)
   973     definitions with member function declarations. It does not implement
   973     definitions with member function declarations. It does not implement
   974     the general C++ function overload resolution rules.
   974     the general C++ function overload resolution rules.
   975 */
   975 */
   976 FunctionMember *Semantic::selectFunction(QList<CodeModel::Member*> candidatateList, const DeclaratorAST *functionDeclarator)
   976 FunctionMember *Semantic::selectFunction(QList<CodeModel::Member*> candidatateList, const DeclaratorAST *functionDeclarator)
   977 {
   977 {
   978     // get arguments for funciton we are looking for
   978     // get arguments for function we are looking for
   979     FunctionMember testFunction;
   979     FunctionMember testFunction;
   980     parseFunctionArguments(functionDeclarator, &testFunction);
   980     parseFunctionArguments(functionDeclarator, &testFunction);
   981     const ArgumentCollection testArgumentCollection = testFunction.arguments();
   981     const ArgumentCollection testArgumentCollection = testFunction.arguments();
   982 
   982 
   983     //test againts functions in overload list.
   983     //test againts functions in overload list.