Mercurial Hosting > luan
comparison core/src/luan/LuanBit.java @ 574:6cc2f047019b
remove LuanState.call()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 13 Jul 2015 12:31:53 -0600 |
parents | f1601a4ce1aa |
children | 7c3ad6db8ac3 |
comparison
equal
deleted
inserted
replaced
573:894f991baac5 | 574:6cc2f047019b |
---|---|
29 public void dumpStack() { | 29 public void dumpStack() { |
30 System.err.println( stackTrace() ); | 30 System.err.println( stackTrace() ); |
31 } | 31 } |
32 | 32 |
33 public Object call(LuanFunction fn,String fnName,Object[] args) throws LuanException { | 33 public Object call(LuanFunction fn,String fnName,Object[] args) throws LuanException { |
34 if( el == null ) | 34 push(fnName); |
35 return fn.call(luan,args); | |
36 List<StackTraceElement> stackTrace = luan.stackTrace; | |
37 stackTrace.add( new StackTraceElement(el,fnName) ); | |
38 try { | 35 try { |
39 return fn.call(luan,args); | 36 return fn.call(luan,args); |
40 } catch(StackOverflowError e) { | 37 } catch(StackOverflowError e) { |
41 throw exception("stack overflow"); | 38 throw exception("stack overflow"); |
42 } finally { | 39 } finally { |
43 stackTrace.remove(stackTrace.size()-1); | 40 pop(); |
44 } | 41 } |
42 } | |
43 | |
44 public void push(String fnName) { | |
45 if( el == null ) throw new RuntimeException(); | |
46 List<StackTraceElement> stackTrace = luan.stackTrace; | |
47 stackTrace.add( new StackTraceElement(el,fnName) ); | |
48 } | |
49 | |
50 public void pop() { | |
51 List<StackTraceElement> stackTrace = luan.stackTrace; | |
52 stackTrace.remove(stackTrace.size()-1); | |
45 } | 53 } |
46 | 54 |
47 public String checkString(Object obj) throws LuanException { | 55 public String checkString(Object obj) throws LuanException { |
48 if( obj instanceof String ) | 56 if( obj instanceof String ) |
49 return (String)obj; | 57 return (String)obj; |