Mercurial Hosting > luan
diff core/src/luan/impl/LeExpr.java @ 576:4723d22062ce
remove LuanBit
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 13 Jul 2015 20:38:26 -0600 |
parents | b48cfa14ba60 |
children | 60c549d43988 |
line wrap: on
line diff
--- a/core/src/luan/impl/LeExpr.java Mon Jul 13 18:34:31 2015 -0600 +++ b/core/src/luan/impl/LeExpr.java Mon Jul 13 20:38:26 2015 -0600 @@ -4,7 +4,6 @@ import luan.LuanFunction; import luan.LuanException; import luan.LuanElement; -import luan.LuanBit; final class LeExpr extends BinaryOpExpr { @@ -30,13 +29,17 @@ String s2 = (String)o2; return s1.compareTo(s2) <= 0; } - LuanBit bit = luan.bit(el); - LuanFunction fn = bit.getBinHandler("__le",o1,o2); - if( fn != null ) - return bit.checkBoolean( Luan.first(bit.call(fn,"__le",new Object[]{o1,o2})) ); - fn = bit.getBinHandler("__lt",o1,o2); - if( fn != null ) - return !bit.checkBoolean( Luan.first(bit.call(fn,"__lt",new Object[]{o2,o1})) ); - throw bit.exception( "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) ); + luan.push(el,null); + try { + LuanFunction fn = luan.getBinHandler("__le",o1,o2); + if( fn != null ) + return luan.checkBoolean( Luan.first(fn.call(luan,new Object[]{o1,o2})) ); + fn = luan.getBinHandler("__lt",o1,o2); + if( fn != null ) + return !luan.checkBoolean( Luan.first(fn.call(luan,new Object[]{o2,o1})) ); + throw luan.exception( "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) ); + } finally { + luan.pop(); + } } }