diff options
author | Rich Hickey <richhickey@gmail.com> | 2006-10-03 21:38:40 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2006-10-03 21:38:40 +0000 |
commit | 8acca11d1aa4ffdf1facf48ca1b8aec6d6bf0e7f (patch) | |
tree | fcb58832c2b9687470b0f2bd8acfbad634c6b06f | |
parent | 25814b673de2a3bb007bbdeb7891996d80f74449 (diff) |
interim checkin
-rw-r--r-- | src/jvm/clojure/lang/Compiler.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java index f21635e4..893dd0fe 100644 --- a/src/jvm/clojure/lang/Compiler.java +++ b/src/jvm/clojure/lang/Compiler.java @@ -307,7 +307,7 @@ private static Expr analyzeSeq(C context, ISeq form) throws Exception { else if(op == NOT || op == NULL_QM_) return analyzeNot(context, form); else - throw new UnsupportedOperationException(); + throw new Exception("Unsupported op: " + op); } private static Expr analyzeLet(C context, ISeq form) throws Exception { @@ -365,7 +365,23 @@ static class LetExpr extends AnExpr{ this.body = body; } - public void emitExpression() throws Exception { + public void emitStatement() throws Exception { + emitBindings(); + body.emitStatement(); + } + + private void emitBindings() throws Exception { + for(int i=0;i<bindingInits.count();i++) + { + BindingInit bi = (BindingInit) bindingInits.nth(i); + if(!(bi.init instanceof FnExpr && ((FnExpr)bi.init).willBeStaticMethod())) + bi.binding.emitDeclaration(bi.init.emitExpressionString()); + } + } + + public void emitReturn() throws Exception { + emitBindings(); + body.emitReturn(); } } |