Commit 0d314977 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Annotated the NameAST nodes.

parent 95d8b844
...@@ -422,6 +422,9 @@ public: ...@@ -422,6 +422,9 @@ public:
NameAST *name; NameAST *name;
BaseSpecifierAST *next; BaseSpecifierAST *next;
public: // annotations
BaseClass *base_class_symbol;
public: public:
virtual unsigned firstToken() const; virtual unsigned firstToken() const;
virtual unsigned lastToken() const; virtual unsigned lastToken() const;
...@@ -1060,6 +1063,9 @@ protected: ...@@ -1060,6 +1063,9 @@ protected:
class CPLUSPLUS_EXPORT NameAST: public ExpressionAST class CPLUSPLUS_EXPORT NameAST: public ExpressionAST
{ {
public: // annotations
Name *name;
public: public:
virtual NameAST *clone(MemoryPool *pool) const = 0; virtual NameAST *clone(MemoryPool *pool) const = 0;
}; };
......
...@@ -121,6 +121,8 @@ bool CheckName::visit(QualifiedNameAST *ast) ...@@ -121,6 +121,8 @@ bool CheckName::visit(QualifiedNameAST *ast)
names.push_back(semantic()->check(ast->unqualified_name, _scope)); names.push_back(semantic()->check(ast->unqualified_name, _scope));
_name = control()->qualifiedNameId(&names[0], names.size(), _name = control()->qualifiedNameId(&names[0], names.size(),
ast->global_scope_token != 0); ast->global_scope_token != 0);
ast->name = _name;
return false; return false;
} }
...@@ -302,6 +304,7 @@ bool CheckName::visit(OperatorFunctionIdAST *ast) ...@@ -302,6 +304,7 @@ bool CheckName::visit(OperatorFunctionIdAST *ast)
} // switch } // switch
_name = control()->operatorNameId(kind); _name = control()->operatorNameId(kind);
ast->name = _name;
return false; return false;
} }
...@@ -317,6 +320,7 @@ bool CheckName::visit(SimpleNameAST *ast) ...@@ -317,6 +320,7 @@ bool CheckName::visit(SimpleNameAST *ast)
{ {
Identifier *id = identifier(ast->identifier_token); Identifier *id = identifier(ast->identifier_token);
_name = control()->nameId(id); _name = control()->nameId(id);
ast->name = _name;
return false; return false;
} }
...@@ -324,6 +328,7 @@ bool CheckName::visit(DestructorNameAST *ast) ...@@ -324,6 +328,7 @@ bool CheckName::visit(DestructorNameAST *ast)
{ {
Identifier *id = identifier(ast->identifier_token); Identifier *id = identifier(ast->identifier_token);
_name = control()->destructorNameId(id); _name = control()->destructorNameId(id);
ast->name = _name;
return false; return false;
} }
...@@ -342,6 +347,7 @@ bool CheckName::visit(TemplateIdAST *ast) ...@@ -342,6 +347,7 @@ bool CheckName::visit(TemplateIdAST *ast)
else else
_name = control()->templateNameId(id, &templateArguments[0], _name = control()->templateNameId(id, &templateArguments[0],
templateArguments.size()); templateArguments.size());
ast->name = _name;
return false; return false;
} }
......
...@@ -315,6 +315,7 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast) ...@@ -315,6 +315,7 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
for (BaseSpecifierAST *base = ast->base_clause; base; base = base->next) { for (BaseSpecifierAST *base = ast->base_clause; base; base = base->next) {
Name *baseClassName = semantic()->check(base->name, _scope); Name *baseClassName = semantic()->check(base->name, _scope);
BaseClass *baseClass = control()->newBaseClass(ast->firstToken(), baseClassName); BaseClass *baseClass = control()->newBaseClass(ast->firstToken(), baseClassName);
base->base_class_symbol = baseClass;
if (base->token_virtual) if (base->token_virtual)
baseClass->setVirtual(true); baseClass->setVirtual(true);
if (base->token_access_specifier) { if (base->token_access_specifier) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment