diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-08-12 17:40:13 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-08-12 17:40:13 +0200 |
commit | f261ac0ea6437e5219959848602187dc92bcffa0 (patch) | |
tree | a12bfe6e0508d425fbfc5cfbbbd2ac1d9646bb9f /src/shared/cplusplus | |
parent | 883b56af6823b894fca94209b2946a99af0b7892 (diff) | |
download | qt-creator-f261ac0ea6437e5219959848602187dc92bcffa0.tar.gz |
Process the ptr-declarators.
Diffstat (limited to 'src/shared/cplusplus')
-rw-r--r-- | src/shared/cplusplus/Bind.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/shared/cplusplus/Bind.cpp b/src/shared/cplusplus/Bind.cpp index ad7f5f445c..1bf40a53a8 100644 --- a/src/shared/cplusplus/Bind.cpp +++ b/src/shared/cplusplus/Bind.cpp @@ -2014,32 +2014,46 @@ bool Bind::visit(EnumSpecifierAST *ast) // PtrOperatorAST bool Bind::visit(PointerToMemberAST *ast) { - // unsigned global_scope_token = ast->global_scope_token; + const Name *memberName = 0; + for (NestedNameSpecifierListAST *it = ast->nested_name_specifier_list; it; it = it->next) { - /*const Name *nested_name_specifier = */ this->nestedNameSpecifier(it->value); + const Name *class_or_namespace_name = this->nestedNameSpecifier(it->value); + if (memberName || ast->global_scope_token) + memberName = control()->qualifiedNameId(memberName, class_or_namespace_name); + else + memberName = class_or_namespace_name; } - FullySpecifiedType type; - // unsigned star_token = ast->star_token; + + FullySpecifiedType type(control()->pointerToMemberType(memberName, _type)); for (SpecifierListAST *it = ast->cv_qualifier_list; it; it = it->next) { type = this->specifier(it->value, type); } + _type = type; return false; } bool Bind::visit(PointerAST *ast) { - // unsigned star_token = ast->star_token; - FullySpecifiedType type; + if (_type->isReferenceType()) + translationUnit()->error(ast->firstToken(), "cannot declare pointer to a reference"); + + FullySpecifiedType type(control()->pointerType(_type)); for (SpecifierListAST *it = ast->cv_qualifier_list; it; it = it->next) { type = this->specifier(it->value, type); } + _type = type; return false; } bool Bind::visit(ReferenceAST *ast) { - (void) ast; - // unsigned reference_token = ast->reference_token; + const bool rvalueRef = (tokenKind(ast->reference_token) == T_AMPER_AMPER); + + if (_type->isReferenceType()) + translationUnit()->error(ast->firstToken(), "cannot declare reference to a reference"); + + FullySpecifiedType type(control()->referenceType(_type, rvalueRef)); + _type = type; return false; } |