Get rid of Function::block/setBlock.

This commit is contained in:
Roberto Raggi
2010-08-16 11:13:20 +02:00
parent 5cc32e1079
commit 833f097c1d
3 changed files with 4 additions and 16 deletions

View File

@@ -1905,7 +1905,6 @@ bool Bind::visit(FunctionDefinitionAST *ast)
if (CompoundStatementAST *c = ast->function_body->asCompoundStatement()) { if (CompoundStatementAST *c = ast->function_body->asCompoundStatement()) {
if (c->symbol) { if (c->symbol) {
fun->setBlock(c->symbol);
fun->setEndOffset(c->symbol->endOffset()); fun->setEndOffset(c->symbol->endOffset());
} }
} }

View File

@@ -164,7 +164,6 @@ void TypenameArgument::visitSymbol0(SymbolVisitor *visitor)
Function::Function(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name) Function::Function(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
: Scope(translationUnit, sourceLocation, name), : Scope(translationUnit, sourceLocation, name),
_block(0),
_flags(0) _flags(0)
{ } { }
@@ -189,12 +188,6 @@ int Function::methodKey() const
void Function::setMethodKey(int key) void Function::setMethodKey(int key)
{ f._methodKey = key; } { f._methodKey = key; }
Block *Function::block() const
{ return _block; }
void Function::setBlock(Block *block)
{ _block = block; }
bool Function::isEqualTo(const Type *other) const bool Function::isEqualTo(const Type *other) const
{ {
const Function *o = other->asFunctionType(); const Function *o = other->asFunctionType();
@@ -293,10 +286,10 @@ bool Function::hasReturnType() const
unsigned Function::argumentCount() const unsigned Function::argumentCount() const
{ {
if (_block) const unsigned c = memberCount();
return memberCount() - 1; if (c > 0 && memberAt(c - 1)->isBlock())
return c - 1;
return memberCount(); return c;
} }
Symbol *Function::argumentAt(unsigned index) const Symbol *Function::argumentAt(unsigned index) const

View File

@@ -297,9 +297,6 @@ public:
int methodKey() const; int methodKey() const;
void setMethodKey(int key); void setMethodKey(int key);
Block *block() const;
void setBlock(Block *block);
FullySpecifiedType returnType() const; FullySpecifiedType returnType() const;
void setReturnType(const FullySpecifiedType &returnType); void setReturnType(const FullySpecifiedType &returnType);
@@ -360,7 +357,6 @@ protected:
private: private:
FullySpecifiedType _returnType; FullySpecifiedType _returnType;
Block *_block;
struct Flags { struct Flags {
unsigned _isVirtual: 1; unsigned _isVirtual: 1;
unsigned _isVariadic: 1; unsigned _isVariadic: 1;