changeset 459:30544d1a9cbf

better stack overflow handling
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 06 May 2015 12:58:06 -0600
parents 507c0af598ba
children b48cfa14ba60
files core/src/luan/LuanBit.java core/src/luan/impl/LuanCompiler.java
diffstat 2 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/core/src/luan/LuanBit.java	Wed May 06 12:29:37 2015 -0600
+++ b/core/src/luan/LuanBit.java	Wed May 06 12:58:06 2015 -0600
@@ -36,6 +36,8 @@
 		stackTrace.add( new StackTraceElement(el,fnName) );
 		try {
 			return fn.call(luan,args);
+		} catch(StackOverflowError e) {
+			throw exception("stack overflow");
 		} finally {
 			stackTrace.remove(stackTrace.size()-1);
 		}
--- a/core/src/luan/impl/LuanCompiler.java	Wed May 06 12:29:37 2015 -0600
+++ b/core/src/luan/impl/LuanCompiler.java	Wed May 06 12:58:06 2015 -0600
@@ -38,9 +38,6 @@
 //e.printStackTrace();
 			LuanElement le = new LuanSource.CompilerElement(parser.source);
 			throw luan.bit(le).exception( e.getFancyMessage() );
-		} catch(StackOverflowError e) {
-			LuanElement le = new LuanSource.CompilerElement(parser.source);
-			throw luan.bit(le).exception("stack overflow");
 		}
 	}