From 77d27b3495bfa98c5e13707903e4f885e8521ab6 Mon Sep 17 00:00:00 2001
From: David Robillard <d@drobilla.net>
Date: Tue, 25 Dec 2012 08:35:43 +0000
Subject: Support multiple ellipses in macros. Support lambda expressions with
 empty argument lists.

git-svn-id: http://svn.drobilla.net/resp/trunk@445 ad02d1e2-f140-0410-9f75-f8b11f17cedd
---
 src/simplify.cpp | 39 ++-------------------------------------
 1 file changed, 2 insertions(+), 37 deletions(-)

(limited to 'src/simplify.cpp')

diff --git a/src/simplify.cpp b/src/simplify.cpp
index f1b1bec..34c1ef0 100644
--- a/src/simplify.cpp
+++ b/src/simplify.cpp
@@ -139,39 +139,6 @@ simplify_list(CEnv& cenv, Code& code, const ATuple* call) throw()
 	return copy;
 }
 
-static const AST*
-simplify_let(CEnv& cenv, Code& code, const ATuple* call) throw()
-{
-	const ATuple* vars = call->list_ref(1)->to_tuple();
-
-	List fn(Cursor(), cenv.penv.sym("lambda"), NULL);
-
-	List fnProt;
-	List fnArgs;
-	List fnProtT;
-	for (ATuple::const_iterator i = vars->begin(); i != vars->end();) {
-		const ASymbol* sym = (*i++)->to_symbol();
-		const AST*     val = (*i++);
-		fnProt.push_back(sym);
-		fnArgs.push_back(resp_simplify(cenv, code, val));
-		fnProtT.push_back(cenv.type(val));
-	}
-
-	fn.push_back(fnProt.head);
-	fn.push_back(resp_simplify(cenv, code, call->list_ref(2)));
-
-	List fnT;
-	fnT.push_back(cenv.tenv.Fn);
-	fnT.push_back(fnProtT);
-	fnT.push_back(cenv.type(call->list_ref(2)));
-	cenv.setType(fn, fnT);
-
-	ATuple* copy = new ATuple(fn, fnArgs, call->loc);
-	cenv.setTypeSameAs(copy, call);
-
-	return copy;
-}
-
 static inline const AST*
 quote(CEnv& cenv, const AST* ast);
 
@@ -219,18 +186,16 @@ const AST*
 resp_simplify(CEnv& cenv, Code& code, const AST* ast) throw()
 {
 	const ATuple* const list = ast->to_tuple();
-	if (!list)
+	if (!list || !list->fst())
 		return ast;
 	
-	const ASymbol* const sym  = list->fst()->to_symbol();
+	const ASymbol* const sym  = list->fst() ? list->fst()->to_symbol() : 0;
 	const std::string    form = sym ? sym->sym() : "";
 
 	if (form == "match")
 		return simplify_match(cenv, code, list);
 	else if (form == "if")
 		return simplify_if(cenv, code, list);
-	else if (form == "let")
-		return simplify_let(cenv, code, list);
 	else if (form == "quote")
 		return simplify_quote(cenv, code, list);
 	else
-- 
cgit v1.2.1