diff src/luan/interp/LeExpr.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 a443637829c1
line wrap: on
line diff
--- a/src/luan/interp/LeExpr.java	Thu Dec 20 02:54:06 2012 +0000
+++ b/src/luan/interp/LeExpr.java	Fri Dec 21 10:45:54 2012 +0000
@@ -4,12 +4,13 @@
 import luan.LuaNumber;
 import luan.LuaFunction;
 import luan.LuaException;
+import luan.LuaSource;
 
 
 final class LeExpr extends BinaryOpExpr {
 
-	LeExpr(Expr op1,Expr op2) {
-		super(op1,op2);
+	LeExpr(LuaSource.Element se,Expr op1,Expr op2) {
+		super(se,op1,op2);
 	}
 
 	@Override public Object eval(LuaStateImpl lua) throws LuaException {
@@ -25,12 +26,12 @@
 			String s2 = (String)o2;
 			return s1.compareTo(s2) <= 0;
 		}
-		LuaFunction fn = lua.getBinHandler("__le",o1,o2);
+		LuaFunction fn = lua.getBinHandler(se,"__le",o1,o2);
 		if( fn != null )
-			return Lua.toBoolean( Utils.first(fn.call(lua,o1,o2)) );
-		fn = lua.getBinHandler("__lt",o1,o2);
+			return Lua.toBoolean( Lua.first(lua.call(fn,se,"__le",o1,o2)) );
+		fn = lua.getBinHandler(se,"__lt",o1,o2);
 		if( fn != null )
-			return !Lua.toBoolean( Utils.first(fn.call(lua,o2,o1)) );
-		throw new LuaException( "attempt to compare " + Lua.type(o1) + " with " + Lua.type(o2) );
+			return !Lua.toBoolean( Lua.first(lua.call(fn,se,"__lt",o2,o1)) );
+		throw new LuaException( lua, se, "attempt to compare " + Lua.type(o1) + " with " + Lua.type(o2) );
 	}
 }