Mercurial Hosting > luan
diff core/src/luan/impl/UnmExpr.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/UnmExpr.java Mon Jul 13 18:34:31 2015 -0600 +++ b/core/src/luan/impl/UnmExpr.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; import luan.LuanTable; @@ -19,13 +18,17 @@ Object o = op.eval(luan); if( o instanceof Number ) return -((Number)o).doubleValue(); - LuanBit bit = luan.bit(el); - if( o instanceof LuanTable ) { - LuanFunction fn = bit.getHandlerFunction("__unm",(LuanTable)o); - if( fn != null ) { - return Luan.first(bit.call(fn,"__unm",new Object[]{o})); + luan.push(el,null); + try { + if( o instanceof LuanTable ) { + LuanFunction fn = luan.getHandlerFunction("__unm",(LuanTable)o); + if( fn != null ) { + return Luan.first(fn.call(luan,new Object[]{o})); + } } + throw luan.exception("attempt to perform arithmetic on a "+Luan.type(o)+" value"); + } finally { + luan.pop(); } - throw bit.exception("attempt to perform arithmetic on a "+Luan.type(o)+" value"); } }