Mercurial Hosting > luan
diff src/luan/interp/FnCall.java @ 40:e3624b7cd603
implement stack trace
git-svn-id: https://luan-java.googlecode.com/svn/trunk@41 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 21 Dec 2012 10:45:54 +0000 |
parents | 8a57ebfdfd78 |
children | 64ecb7a3aad7 |
line wrap: on
line diff
--- a/src/luan/interp/FnCall.java Thu Dec 20 02:54:06 2012 +0000 +++ b/src/luan/interp/FnCall.java Fri Dec 21 10:45:54 2012 +0000 @@ -3,15 +3,19 @@ import luan.Lua; import luan.LuaFunction; import luan.LuaException; +import luan.LuaSource; -final class FnCall implements Expressions { +final class FnCall extends CodeImpl implements Expressions { final Expr fnExpr; final Expressions args; + final String fnName; - FnCall(Expr fnExpr,Expressions args) { + FnCall(LuaSource.Element se,Expr fnExpr,Expressions args) { + super(se); this.fnExpr = fnExpr; this.args = args; + this.fnName = fnExpr.se().text(); } @Override public Object[] eval(LuaStateImpl lua) throws LuaException { @@ -21,11 +25,11 @@ private Object[] call(LuaStateImpl lua,Object o) throws LuaException { if( o instanceof LuaFunction ) { LuaFunction fn = (LuaFunction)o; - return fn.call( lua, args.eval(lua) ); + return lua.call( fn, se, fnName, args.eval(lua) ); } Object h = lua.getHandler("__call",o); if( h != null ) return call(lua,h); - throw new LuaException( "attempt to call a " + Lua.type(o) + " value" ); + throw new LuaException( lua, se, "attempt to call a " + Lua.type(o) + " value" ); } }