forked from qt-creator/qt-creator
Added some initial support for function overloading.
This commit is contained in:
@@ -759,6 +759,22 @@ const Identifier *Control::objcCopyId() const
|
||||
const Identifier *Control::objcNonatomicId() const
|
||||
{ return d->objcNonatomicId; }
|
||||
|
||||
Symbol **Control::firstSymbol() const
|
||||
{
|
||||
if (d->symbols.empty())
|
||||
return 0;
|
||||
|
||||
return &*d->symbols.begin();
|
||||
}
|
||||
|
||||
Symbol **Control::lastSymbol() const
|
||||
{
|
||||
if (d->symbols.empty())
|
||||
return 0;
|
||||
|
||||
return &*d->symbols.begin() + d->symbols.size();
|
||||
}
|
||||
|
||||
bool Control::hasSymbol(Symbol *symbol) const
|
||||
{
|
||||
return std::find(d->symbols.begin(), d->symbols.end(), symbol) != d->symbols.end();
|
||||
|
||||
@@ -212,6 +212,9 @@ public:
|
||||
const NumericLiteral *numericLiteral(const char *chars, unsigned size);
|
||||
const NumericLiteral *numericLiteral(const char *chars);
|
||||
|
||||
Symbol **firstSymbol() const;
|
||||
Symbol **lastSymbol() const;
|
||||
|
||||
bool hasSymbol(Symbol *symbol) const;
|
||||
|
||||
void squeeze();
|
||||
|
||||
@@ -362,6 +362,30 @@ void Function::visitSymbol0(SymbolVisitor *visitor)
|
||||
}
|
||||
}
|
||||
|
||||
bool Function::maybeValidPrototype(unsigned actualArgumentCount) const
|
||||
{
|
||||
unsigned minNumberArguments = 0;
|
||||
|
||||
for (; minNumberArguments < this->argumentCount(); ++minNumberArguments) {
|
||||
Argument *arg = this->argumentAt(minNumberArguments)->asArgument();
|
||||
|
||||
if (arg->hasInitializer())
|
||||
break;
|
||||
}
|
||||
|
||||
if (actualArgumentCount < minNumberArguments) {
|
||||
// not enough arguments.
|
||||
return false;
|
||||
|
||||
} else if (! this->isVariadic() && actualArgumentCount > this->argumentCount()) {
|
||||
// too many arguments.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Block::Block(TranslationUnit *translationUnit, unsigned sourceLocation)
|
||||
: Scope(translationUnit, sourceLocation, /*name = */ 0)
|
||||
{ }
|
||||
|
||||
@@ -350,6 +350,8 @@ public:
|
||||
bool isAmbiguous() const; // internal
|
||||
void setAmbiguous(bool isAmbiguous); // internal
|
||||
|
||||
bool maybeValidPrototype(unsigned actualArgumentCount) const;
|
||||
|
||||
protected:
|
||||
virtual void visitSymbol0(SymbolVisitor *visitor);
|
||||
virtual void accept0(TypeVisitor *visitor);
|
||||
|
||||
Reference in New Issue
Block a user