This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: a new bug when compiling object statement, patch candidate included
- From: Chris Dean <Chris dot Dean at sokitomi dot com>
- To: Vladimir Tsichevski <wowa at jet dot msk dot su>
- Cc: Kawa List <kawa at sources dot redhat dot com>
- Date: Tue, 01 Apr 2003 15:07:10 -0800
- Subject: Re: a new bug when compiling object statement, patch candidate included
- References: <3E842C1D.5080607@jet.msk.su>
Here's a similar bug:
(module-name <Foo>)
(define-simple-class <Bar> ()
((get-x) 'x)
((get-y) (get-x)))
When compiled this gives:
java.lang.NullPointerException
at gnu.bytecode.CodeAttr.emitLoad(CodeAttr.java:1046)
at gnu.expr.LambdaExp.loadHeapFrame(LambdaExp.java:427)
at gnu.expr.ApplyExp.compile(ApplyExp.java:193)
Using Vladimir's fix as a template, I'll provide a patch:
Index: LambdaExp.java
===================================================================
RCS file: /cvs/kawa/kawa/gnu/expr/LambdaExp.java,v
retrieving revision 1.70
diff -u -r1.70 LambdaExp.java
--- LambdaExp.java 3 Mar 2003 20:05:25 -0000 1.70
+++ LambdaExp.java 1 Apr 2003 23:06:26 -0000
@@ -424,7 +424,10 @@
}
else
{
- code.emitLoad(curLambda.closureEnv);
+ if (curLambda.closureEnv == null)
+ code.emitPushThis();
+ else
+ code.emitLoad(curLambda.closureEnv);
LambdaExp parent = curLambda.outerLambda();
while (parent != this)
{
Regards,
Chris Dean
Vladimir Tsichevski <wowa at jet dot msk dot su> wrote:
> I provide a patch which at least allows the compilation and PROBABLY
> (!) creates right codes.