diff options
author | David Robillard <d@drobilla.net> | 2010-12-29 22:50:20 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-29 22:50:20 +0000 |
commit | 2eda11ca28589991471ff3251cccc2471424770e (patch) | |
tree | a763edd57dcdcabba3f5eccf5af23f52d90b1eca /src/resp.hpp | |
parent | 0076c050fb12c92a35b673d63fca82d5cff63bdb (diff) | |
download | resp-2eda11ca28589991471ff3251cccc2471424770e.tar.gz resp-2eda11ca28589991471ff3251cccc2471424770e.tar.bz2 resp-2eda11ca28589991471ff3251cccc2471424770e.zip |
Destructuring (i.e. working `match').
git-svn-id: http://svn.drobilla.net/resp/resp@374 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/resp.hpp')
-rw-r--r-- | src/resp.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/resp.hpp b/src/resp.hpp index 57880f5..ba0ae4b 100644 --- a/src/resp.hpp +++ b/src/resp.hpp @@ -528,7 +528,8 @@ struct Subst : public list<Constraint> { List out; for (ATuple::const_iterator i = in->as_tuple()->begin(); i != in->as_tuple()->end(); ++i) out.push_back(apply((*i))); - out.head->loc = in->loc; + if (out.head) + out.head->loc = in->loc; return out.head; } else { const_iterator i = find(in); @@ -656,6 +657,7 @@ struct Engine { virtual void eraseFn(CEnv& cenv, CFunc f) = 0; virtual CVal compileCall(CEnv& cenv, CFunc f, const ATuple* fT, CVals& args) = 0; + virtual CVal compileCast(CEnv& cenv, CVal v, const AST* t) = 0; virtual CVal compileCons(CEnv& cenv, const ATuple* t, CVal rtti, CVals& f) = 0; virtual CVal compileDot(CEnv& cenv, CVal tup, int32_t index) = 0; virtual CVal compileGlobalSet(CEnv& cenv, const string& s, CVal v, const AST* t) = 0; @@ -726,7 +728,6 @@ struct CEnv { return rec ? *rec : ast; } void setType(const AST* ast, const AST* type) { - //assert(!ast->to_symbol()); const AST* tvar = tenv.var(); tenv.vars.insert(make_pair(ast, tvar)); tsubst.add(tvar, type); |