Removed Scope::addUse()

This commit is contained in:
Roberto Raggi
2009-08-25 10:19:00 +02:00
parent 1622c86289
commit 63cd7ffe4e
3 changed files with 12 additions and 56 deletions

View File

@@ -168,43 +168,37 @@ bool CheckExpression::visit(ArrayInitializerAST *ast)
bool CheckExpression::visit(QualifiedNameAST *ast)
{
Name *name = semantic()->check(ast, _scope);
_scope->addUse(ast->firstToken(), name);
(void) semantic()->check(ast, _scope);
return false;
}
bool CheckExpression::visit(OperatorFunctionIdAST *ast)
{
Name *name = semantic()->check(ast, _scope);
_scope->addUse(ast->firstToken(), name);
(void) semantic()->check(ast, _scope);
return false;
}
bool CheckExpression::visit(ConversionFunctionIdAST *ast)
{
Name *name = semantic()->check(ast, _scope);
_scope->addUse(ast->firstToken(), name);
(void) semantic()->check(ast, _scope);
return false;
}
bool CheckExpression::visit(SimpleNameAST *ast)
{
Name *name = semantic()->check(ast, _scope);
_scope->addUse(ast->firstToken(), name);
(void) semantic()->check(ast, _scope);
return false;
}
bool CheckExpression::visit(DestructorNameAST *ast)
{
Name *name = semantic()->check(ast, _scope);
_scope->addUse(ast->firstToken(), name);
(void) semantic()->check(ast, _scope);
return false;
}
bool CheckExpression::visit(TemplateIdAST *ast)
{
Name *name = semantic()->check(ast, _scope);
_scope->addUse(ast->firstToken(), name);
(void) semantic()->check(ast, _scope);
return false;
}
@@ -246,11 +240,11 @@ bool CheckExpression::visit(TypeidExpressionAST *ast)
bool CheckExpression::visit(TypenameCallExpressionAST *ast)
{
if (Name *name = semantic()->check(ast->name, _scope)) {
_scope->addUse(ast->name->firstToken(), name);
}
(void) semantic()->check(ast->name, _scope);
for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
FullySpecifiedType exprTy = semantic()->check(it->expression, _scope);
(void) exprTy;
}
return false;
}
@@ -378,17 +372,14 @@ bool CheckExpression::visit(PostIncrDecrAST *)
bool CheckExpression::visit(MemberAccessAST *ast)
{
if (Name *name = semantic()->check(ast->member_name, _scope))
_scope->addUse(ast->member_name->firstToken(), name);
(void) semantic()->check(ast->member_name, _scope);
return false;
}
bool CheckExpression::visit(ObjCMessageExpressionAST *ast)
{
semantic()->check(ast->receiver_expression, _scope);
if (Name *name = semantic()->check(ast->selector, _scope))
_scope->addUse(ast->selector->firstToken(), name);
(void) semantic()->check(ast->selector, _scope);
accept(ast->argument_list);
return false;
@@ -402,9 +393,7 @@ bool CheckExpression::visit(ObjCEncodeExpressionAST * /*ast*/)
bool CheckExpression::visit(ObjCSelectorExpressionAST *ast)
{
if (Name *name = semantic()->check(ast->selector, _scope))
_scope->addUse(ast->selector->firstToken(), name);
(void) semantic()->check(ast->selector, _scope);
return false;
}

View File

@@ -297,7 +297,4 @@ Scope::iterator Scope::firstSymbol() const
Scope::iterator Scope::lastSymbol() const
{ return _symbols + _symbolCount + 1; }
void Scope::addUse(unsigned, Name *)
{ }
CPLUSPLUS_END_NAMESPACE

View File

@@ -54,34 +54,6 @@
CPLUSPLUS_BEGIN_HEADER
CPLUSPLUS_BEGIN_NAMESPACE
class CPLUSPLUS_EXPORT Use
{
public:
inline Name *name() const
{ return _name; }
inline unsigned sourceOffset() const
{ return _sourceOffset; }
inline Symbol *lastVisibleSymbol() const
{ return _lastVisibleSymbol; }
private:
void init(unsigned sourceOffset, Name *name, Symbol *lastVisibleSymbol)
{
_sourceOffset = sourceOffset;
_name = name;
_lastVisibleSymbol = lastVisibleSymbol;
}
unsigned _sourceOffset;
Name *_name;
Symbol *_lastVisibleSymbol;
friend class Scope;
};
class CPLUSPLUS_EXPORT Scope
{
Scope(const Scope &other);
@@ -160,8 +132,6 @@ public:
Symbol *lookat(Identifier *id) const;
Symbol *lookat(int operatorId) const;
void addUse(unsigned sourceOffset, Name *name);
private:
/// Returns the hash value for the given Symbol.
unsigned hashValue(Symbol *symbol) const;