This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: compilation error when apply macro in the same module
Yaroslav Kavenchuk wrote:
The problem is solved if I move macros in a separate module.
But this is bug?
Probably, but you don't give me a complete test-case to try - just
the macro definition, not the macro use.
When the macro is in a separate module, it is compiled to bytecode.
Invoke the macro calls compiled code.
When the macro is in the same module, it hasn't yet been compiled
to bytecode, so it has to be interpreted. That is why you might
be getting different results - it might be a bug or incompleteness
in the Kawa interpreter.
Try applying this patch - it should at least provide a better
error message.
Also, it's a good idea if you can simplify your macro and
example to the simplest possible that still exhibits the error.
That both makes it easier for to track down, and and might
make a better addition to the Kawa test-suite so once the
problem is fixed, it stays fixed.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
Index: gnu/expr/ReferenceExp.java
===================================================================
--- gnu/expr/ReferenceExp.java (revision 5998)
+++ gnu/expr/ReferenceExp.java (working copy)
@@ -139,7 +139,18 @@
return;
}
else
- value = ctx.evalFrames[ScopeExp.nesting(binding.context)][binding.evalIndex];
+ {
+ try
+ {
+ value = ctx.evalFrames[ScopeExp.nesting(binding.context)][binding.evalIndex];
+ }
+ catch (Exception ex)
+ {
+ String msg = "exception evaluating "+symbol+" - "+ex;
+ // We abuse msg as a UnboundLocationException name.
+ throw new UnboundLocationException(msg, this);
+ }
+ }
if (! getDontDereference() && binding.isIndirectBinding())
value = ((gnu.mapping.Location) value).get();
ctx.writeValue(value);