diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-07-19 20:12:16 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-07-19 20:12:16 +0200 |
commit | 33b19f0210cd6ab1504071912caee91a95515c7c (patch) | |
tree | 58a0e1ea6da2f12005f5916ee967680349e47088 /src/libs/cplusplus/CppRewriter.h | |
parent | 55936532c295a3eea221ac6aaca7353f41761c76 (diff) | |
download | qt-creator-33b19f0210cd6ab1504071912caee91a95515c7c.tar.gz |
Try to fix the type rewriter.
Diffstat (limited to 'src/libs/cplusplus/CppRewriter.h')
-rw-r--r-- | src/libs/cplusplus/CppRewriter.h | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/src/libs/cplusplus/CppRewriter.h b/src/libs/cplusplus/CppRewriter.h index 0e21061128..988b92f3a6 100644 --- a/src/libs/cplusplus/CppRewriter.h +++ b/src/libs/cplusplus/CppRewriter.h @@ -51,51 +51,27 @@ public: class CPLUSPLUS_EXPORT SubstitutionEnvironment { Q_DISABLE_COPY(SubstitutionEnvironment) - QList<Substitution *> substs; public: - SubstitutionEnvironment() {} - - FullySpecifiedType apply(const Name *name, Rewrite *rewrite) const - { - if (name) { - for (int index = substs.size() - 1; index != -1; --index) { - const Substitution *subst = substs.at(index); - - FullySpecifiedType ty = subst->apply(name, rewrite); - if (! ty->isUndefinedType()) - return ty; - } - } - - return FullySpecifiedType(); - } - - void enter(Substitution *subst) - { - substs.append(subst); - } - - void leave() - { - substs.removeLast(); - } -}; + SubstitutionEnvironment(); -class CPLUSPLUS_EXPORT ContextSubstitution: public Substitution -{ -public: - ContextSubstitution(const LookupContext &context, Scope *scope); - virtual ~ContextSubstitution(); + FullySpecifiedType apply(const Name *name, Rewrite *rewrite) const; - virtual FullySpecifiedType apply(const Name *name, Rewrite *rewrite) const; + void enter(Substitution *subst); + void leave(); + + Scope *scope() const; + Scope *switchScope(Scope *scope); + + const LookupContext &context() const; + void setContext(const LookupContext &context); private: - LookupContext _context; + QList<Substitution *> _substs; Scope *_scope; + LookupContext _context; }; - class CPLUSPLUS_EXPORT SubstitutionMap: public Substitution { public: @@ -109,6 +85,17 @@ private: QList<QPair<const Name *, FullySpecifiedType> > _map; }; +class CPLUSPLUS_EXPORT UseQualifiedNames: public Substitution +{ +public: + UseQualifiedNames(); + virtual ~UseQualifiedNames(); + + virtual FullySpecifiedType apply(const Name *name, Rewrite *rewrite) const; +}; + + + CPLUSPLUS_EXPORT FullySpecifiedType rewriteType(const FullySpecifiedType &type, SubstitutionEnvironment *env, Control *control); |