aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-12-26 17:56:27 +0000
committerDavid Robillard <d@drobilla.net>2010-12-26 17:56:27 +0000
commitc698116cf88a9e48085b5741f10db4f8c48e8fe5 (patch)
tree47da97abac3fe5f8a5db62f1fd1fe72caa5659c5
parent1e3f0e31b86b27af0f89bf48281673e6b15ea799 (diff)
downloadresp-c698116cf88a9e48085b5741f10db4f8c48e8fe5.tar.gz
resp-c698116cf88a9e48085b5741f10db4f8c48e8fe5.tar.bz2
resp-c698116cf88a9e48085b5741f10db4f8c48e8fe5.zip
Remove AType copy constructor.
git-svn-id: http://svn.drobilla.net/resp/resp@354 ad02d1e2-f140-0410-9f75-f8b11f17cedd
-rw-r--r--src/lift.cpp6
-rw-r--r--src/resp.hpp5
-rw-r--r--src/unify.cpp4
3 files changed, 6 insertions, 9 deletions
diff --git a/src/lift.cpp b/src/lift.cpp
index 6e1767a..25940f4 100644
--- a/src/lift.cpp
+++ b/src/lift.cpp
@@ -115,9 +115,9 @@ lift_fn(CEnv& cenv, Code& code, const ATuple* fn) throw()
cenv.push();
const AType* type = cenv.type(fn);
AType::const_iterator tp = type->prot()->begin();
- List<AType,AType> implProtT;
- List<ATuple, const AST> implProt;
+ List<ATuple, const AST> implProt;
+ List<AType, const AType> implProtT;
// Prepend closure parameter
implProt.push_back(cenv.penv.sym("_me"));
@@ -130,7 +130,7 @@ lift_fn(CEnv& cenv, Code& code, const ATuple* fn) throw()
}
cenv.def((*p)->as_symbol(), *p, paramType, NULL);
implProt.push_back(*p);
- implProtT.push_back(new AType(*paramType));
+ implProtT.push_back(paramType);
}
impl.push_back(implProt);
diff --git a/src/resp.hpp b/src/resp.hpp
index 197a60b..5cb11b6 100644
--- a/src/resp.hpp
+++ b/src/resp.hpp
@@ -359,7 +359,6 @@ struct AType : public ATuple {
AType(Cursor c, Kind k=EXPR) : ATuple(c), kind(k), id(0) { tag(T_TYPE); }
AType(Cursor c, AST* ast, va_list args) : ATuple(c, ast, args), kind(EXPR), id(0) { tag(T_TYPE); }
AType(const AST* first, const AST* rest, Cursor c) : ATuple(first, rest, c), kind(EXPR), id(0) { tag(T_TYPE); }
- AType(const AType& copy) : ATuple(copy), kind(copy.kind), id(copy.id) { tag(T_TYPE); }
AType(const AType& copy, Cursor cur) : ATuple(copy), kind(copy.kind), id(copy.id) {
tag(T_TYPE);
loc = cur;
@@ -612,7 +611,7 @@ struct Subst : public list<Constraint> {
out = apply(out->as_type());
return out;
} else {
- return new AType(*in);
+ return in;
}
}
}
@@ -637,7 +636,7 @@ struct Constraints : public list<Constraint> {
Constraints() : list<Constraint>() {}
explicit Constraints(const Subst& subst) : list<Constraint>() {
FOREACH(Subst::const_iterator, i, subst)
- push_back(Constraint(new AType(*i->first), new AType(*i->second)));
+ push_back(Constraint(i->first, i->second));
}
Constraints(const_iterator begin, const_iterator end) : list<Constraint>(begin, end) {}
void constrain(TEnv& tenv, const AST* o, const AType* t);
diff --git a/src/unify.cpp b/src/unify.cpp
index ae05b67..48818e9 100644
--- a/src/unify.cpp
+++ b/src/unify.cpp
@@ -70,9 +70,7 @@ substitute(const AType* tup, const AType* from, const AType* to)
TList ret;
FOREACHP(AType::const_iterator, i, tup) {
if (**i == *from) {
- AType* type = new AType(*to);
- type->loc = (*i)->loc;
- ret.push_back(type);
+ ret.push_back(new AType(*to, (*i)->loc));
} else if (*i != to) {
const AType* elem = (*i)->as_type();
if (elem->kind == AType::EXPR)