Mercurial Hosting > luan
comparison core/src/luan/impl/Closure.java @ 592:1c64b1fd882b
handle StackOverflowError
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 31 Aug 2015 08:03:58 -0600 |
parents | c6bcb8859b93 |
children | 859c0dedc8b6 |
comparison
equal
deleted
inserted
replaced
591:790d5de23042 | 592:1c64b1fd882b |
---|---|
37 UpValue[] upValues() { | 37 UpValue[] upValues() { |
38 return upValues; | 38 return upValues; |
39 } | 39 } |
40 | 40 |
41 @Override public Object call(LuanState luan,Object[] args) throws LuanException { | 41 @Override public Object call(LuanState luan,Object[] args) throws LuanException { |
42 return call(this,(LuanStateImpl)luan,args); | 42 try { |
43 return call(this,(LuanStateImpl)luan,args); | |
44 } catch(StackOverflowError e) { | |
45 throw new LuanException(luan, "stack overflow" ); | |
46 } | |
43 } | 47 } |
44 | 48 |
45 private static Object call(Closure closure,LuanStateImpl luan,Object[] args) throws LuanException { | 49 private static Object call(Closure closure,LuanStateImpl luan,Object[] args) throws LuanException { |
46 while(true) { | 50 while(true) { |
47 FnDef fnDef = closure.fnDef; | 51 FnDef fnDef = closure.fnDef; |