diff options
author | David Robillard <d@drobilla.net> | 2010-12-27 22:48:00 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-27 22:48:00 +0000 |
commit | cce4f16e87870eae8a1c3f430c9617cefd55fe54 (patch) | |
tree | 79dbeec5b3368045b36719b63d24ea1bc9ef150f /src/simplify.cpp | |
parent | 1a8107c0156e1615fbdbe009f30d8e66cb280c03 (diff) | |
download | resp-cce4f16e87870eae8a1c3f430c9617cefd55fe54.tar.gz resp-cce4f16e87870eae8a1c3f430c9617cefd55fe54.tar.bz2 resp-cce4f16e87870eae8a1c3f430c9617cefd55fe54.zip |
Remove weird __tag_is form by adding a T_LITSYM type and using = operator.
Step towards having first class symbols...
git-svn-id: http://svn.drobilla.net/resp/resp@362 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/simplify.cpp')
-rw-r--r-- | src/simplify.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/simplify.cpp b/src/simplify.cpp index 715202a..397c2b7 100644 --- a/src/simplify.cpp +++ b/src/simplify.cpp @@ -63,10 +63,10 @@ simplify_match(CEnv& cenv, const ATuple* match) throw() tval.push_back(resp_simplify(cenv, match->list_ref(1))); tval.push_back(new ALiteral<int32_t>(T_INT32, -1, Cursor())); - const ASymbol* tsym = cenv.penv.gensym("_matchT"); + const ASymbol* tsym = cenv.penv.gensym("__tag"); List def(match->loc, cenv.penv.sym("def"), tsym, tval.head, NULL); - cenv.setType(tval.head, cenv.tenv.named("String")); + cenv.setType(tval.head, cenv.tenv.named("Symbol")); List copyIf; copyIf.push_back(cenv.penv.sym("if")); @@ -74,10 +74,16 @@ simplify_match(CEnv& cenv, const ATuple* match) throw() const ATuple* pat = (*i++)->as_tuple(); const AST* body = *i++; + const ASymbol* consTag = cenv.penv.sym(pat->head()->str(), pat->head()->loc); + const_cast<ASymbol*>(consTag)->tag(T_LITSYM); + cenv.setType(consTag, cenv.tenv.named("Symbol")); + List cond; - cond.push_back(cenv.penv.sym("__tag_is")); + cond.push_back(cenv.penv.sym("=")); cond.push_back(tsym); - cond.push_back(pat->head()); + cond.push_back(consTag); + + cenv.setType(cond, cenv.tenv.named("Bool")); copyIf.push_back(cond); copyIf.push_back(resp_simplify(cenv, body)); |