summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/CheckDeclaration.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <qtc-committer@nokia.com>2009-02-09 12:19:17 +0100
committerRoberto Raggi <qtc-committer@nokia.com>2009-02-09 12:19:17 +0100
commitea981d502527376bd783a2b1ff204384ea43c381 (patch)
tree48d19d8c05c39ae62c198d537ec8a971b1e33baa /src/shared/cplusplus/CheckDeclaration.cpp
parent3ac4e05e374fe91891d27b240b60ea91308d7184 (diff)
downloadqt-creator-ea981d502527376bd783a2b1ff204384ea43c381.tar.gz
More annotations.
Diffstat (limited to 'src/shared/cplusplus/CheckDeclaration.cpp')
-rw-r--r--src/shared/cplusplus/CheckDeclaration.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp
index 48e6cd40fa..179dd06987 100644
--- a/src/shared/cplusplus/CheckDeclaration.cpp
+++ b/src/shared/cplusplus/CheckDeclaration.cpp
@@ -136,6 +136,7 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
}
}
+ List<Declaration *> **decl_it = &ast->symbols;
for (DeclaratorListAST *it = ast->declarators; it; it = it->next) {
Name *name = 0;
FullySpecifiedType declTy = semantic()->check(it->declarator, qualTy,
@@ -179,6 +180,10 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
else if (ty.isTypedef())
symbol->setStorage(Symbol::Typedef);
+ *decl_it = new (translationUnit()->memoryPool()) List<Declaration *>();
+ (*decl_it)->value = symbol;
+ decl_it = &(*decl_it)->next;
+
_scope->enterSymbol(symbol);
}
return false;
@@ -234,6 +239,7 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
checkFunctionArguments(fun);
+ ast->symbol = fun;
_scope->enterSymbol(fun);
if (ast->ctor_initializer) {
@@ -286,7 +292,7 @@ bool CheckDeclaration::visit(NamespaceAST *ast)
Identifier *id = identifier(ast->identifier_token);
Name *namespaceName = control()->nameId(id);
Namespace *ns = control()->newNamespace(ast->firstToken(), namespaceName);
- ast->namespace_symbol = ns;
+ ast->symbol = ns;
_scope->enterSymbol(ns);
semantic()->check(ast->linkage_body, ns->members()); // ### we'll do the merge later.
@@ -311,6 +317,7 @@ bool CheckDeclaration::visit(ParameterDeclarationAST *ast)
_scope, &argName);
FullySpecifiedType exprTy = semantic()->check(ast->expression, _scope);
Argument *arg = control()->newArgument(ast->firstToken(), argName);
+ ast->symbol = arg;
if (ast->expression)
arg->setInitializer(true);
arg->setType(argTy);
@@ -320,15 +327,6 @@ bool CheckDeclaration::visit(ParameterDeclarationAST *ast)
bool CheckDeclaration::visit(TemplateDeclarationAST *ast)
{
-/*
- Template *templ = control()->newTemplate(ast->firstToken());
-
- for (DeclarationAST *param = ast->template_parameters; param;
- param = param->next) {
- semantic()->check(param, templ->members());
- }
-*/
-
Scope *previousScope = switchScope(new Scope(_scope->owner()));
for (DeclarationAST *param = ast->template_parameters; param;
param = param->next) {
@@ -344,6 +342,7 @@ bool CheckDeclaration::visit(TypenameTypeParameterAST *ast)
{
Name *name = semantic()->check(ast->name, _scope);
Argument *arg = control()->newArgument(ast->firstToken(), name); // ### new template type
+ ast->symbol = arg;
_scope->enterSymbol(arg);
return false;
}
@@ -352,6 +351,7 @@ bool CheckDeclaration::visit(TemplateTypeParameterAST *ast)
{
Name *name = semantic()->check(ast->name, _scope);
Argument *arg = control()->newArgument(ast->firstToken(), name); // ### new template type
+ ast->symbol = arg;
_scope->enterSymbol(arg);
return false;
}
@@ -360,6 +360,7 @@ bool CheckDeclaration::visit(UsingAST *ast)
{
Name *name = semantic()->check(ast->name, _scope);
UsingDeclaration *u = control()->newUsingDeclaration(ast->firstToken(), name);
+ ast->symbol = u;
_scope->enterSymbol(u);
return false;
}
@@ -368,6 +369,7 @@ bool CheckDeclaration::visit(UsingDirectiveAST *ast)
{
Name *name = semantic()->check(ast->name, _scope);
UsingNamespaceDirective *u = control()->newUsingNamespaceDirective(ast->firstToken(), name);
+ ast->symbol = u;
_scope->enterSymbol(u);
return false;
}