Commit 55936532 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Disable the copy of SemanticEnvironment.

parent 1702543d
...@@ -43,7 +43,7 @@ using namespace CPlusPlus; ...@@ -43,7 +43,7 @@ using namespace CPlusPlus;
class CPlusPlus::Rewrite class CPlusPlus::Rewrite
{ {
public: public:
Rewrite(Control *control, const SubstitutionEnvironment &env) Rewrite(Control *control, SubstitutionEnvironment *env)
: control(control), env(env), rewriteType(this), rewriteName(this) {} : control(control), env(env), rewriteType(this), rewriteName(this) {}
class RewriteType: public TypeVisitor class RewriteType: public TypeVisitor
...@@ -118,7 +118,7 @@ public: ...@@ -118,7 +118,7 @@ public:
virtual void visit(NamedType *type) virtual void visit(NamedType *type)
{ {
FullySpecifiedType ty = rewrite->env.apply(type->name(), rewrite); FullySpecifiedType ty = rewrite->env->apply(type->name(), rewrite);
if (! ty->isUndefinedType()) if (! ty->isUndefinedType())
temps.append(rewrite->rewriteType(ty)); temps.append(rewrite->rewriteType(ty));
else { else {
...@@ -281,7 +281,7 @@ public: ...@@ -281,7 +281,7 @@ public:
public: // attributes public: // attributes
Control *control; Control *control;
SubstitutionEnvironment env; SubstitutionEnvironment *env;
RewriteType rewriteType; RewriteType rewriteType;
RewriteName rewriteName; RewriteName rewriteName;
}; };
...@@ -309,9 +309,9 @@ FullySpecifiedType ContextSubstitution::apply(const Name *name, Rewrite *rewrite ...@@ -309,9 +309,9 @@ FullySpecifiedType ContextSubstitution::apply(const Name *name, Rewrite *rewrite
<< r.scope()->owner()->column(); << r.scope()->owner()->column();
ContextSubstitution subst(_context, s->scope()); ContextSubstitution subst(_context, s->scope());
rewrite->env.enter(&subst); rewrite->env->enter(&subst);
FullySpecifiedType ty = rewrite->rewriteType(s->type()); FullySpecifiedType ty = rewrite->rewriteType(s->type());
rewrite->env.leave(); rewrite->env->leave();
return ty; return ty;
} }
...@@ -348,7 +348,7 @@ FullySpecifiedType SubstitutionMap::apply(const Name *name, Rewrite *) const ...@@ -348,7 +348,7 @@ FullySpecifiedType SubstitutionMap::apply(const Name *name, Rewrite *) const
} }
FullySpecifiedType CPlusPlus::rewriteType(const FullySpecifiedType &type, FullySpecifiedType CPlusPlus::rewriteType(const FullySpecifiedType &type,
const SubstitutionEnvironment &env, SubstitutionEnvironment *env,
Control *control) Control *control)
{ {
Rewrite rewrite(control, env); Rewrite rewrite(control, env);
...@@ -356,7 +356,7 @@ FullySpecifiedType CPlusPlus::rewriteType(const FullySpecifiedType &type, ...@@ -356,7 +356,7 @@ FullySpecifiedType CPlusPlus::rewriteType(const FullySpecifiedType &type,
} }
const Name *CPlusPlus::rewriteName(const Name *name, const Name *CPlusPlus::rewriteName(const Name *name,
const SubstitutionEnvironment &env, SubstitutionEnvironment *env,
Control *control) Control *control)
{ {
Rewrite rewrite(control, env); Rewrite rewrite(control, env);
......
...@@ -50,9 +50,12 @@ public: ...@@ -50,9 +50,12 @@ public:
class CPLUSPLUS_EXPORT SubstitutionEnvironment class CPLUSPLUS_EXPORT SubstitutionEnvironment
{ {
Q_DISABLE_COPY(SubstitutionEnvironment)
QList<Substitution *> substs; QList<Substitution *> substs;
public: public:
SubstitutionEnvironment() {}
FullySpecifiedType apply(const Name *name, Rewrite *rewrite) const FullySpecifiedType apply(const Name *name, Rewrite *rewrite) const
{ {
if (name) { if (name) {
...@@ -107,11 +110,11 @@ private: ...@@ -107,11 +110,11 @@ private:
}; };
CPLUSPLUS_EXPORT FullySpecifiedType rewriteType(const FullySpecifiedType &type, CPLUSPLUS_EXPORT FullySpecifiedType rewriteType(const FullySpecifiedType &type,
const SubstitutionEnvironment &env, SubstitutionEnvironment *env,
Control *control); Control *control);
CPLUSPLUS_EXPORT const Name *rewriteName(const Name *name, CPLUSPLUS_EXPORT const Name *rewriteName(const Name *name,
const SubstitutionEnvironment &env, SubstitutionEnvironment *env,
Control *control); Control *control);
} // end of namespace CPlusPlus } // end of namespace CPlusPlus
......
...@@ -572,7 +572,7 @@ QList<LookupItem> ResolveExpression::getMembers(ClassOrNamespace *binding, const ...@@ -572,7 +572,7 @@ QList<LookupItem> ResolveExpression::getMembers(ClassOrNamespace *binding, const
env.enter(&ctxSubst); env.enter(&ctxSubst);
env.enter(&map); env.enter(&map);
FullySpecifiedType instantiatedTy = rewriteType(decl->type(), env, _context.control().data()); FullySpecifiedType instantiatedTy = rewriteType(decl->type(), &env, _context.control().data());
Overview oo; Overview oo;
oo.setShowReturnTypes(true); oo.setShowReturnTypes(true);
......
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