Mercurial Hosting > luan
diff core/src/luan/impl/BinaryOpExpr.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/BinaryOpExpr.java Mon Jul 13 18:34:31 2015 -0600 +++ b/core/src/luan/impl/BinaryOpExpr.java Mon Jul 13 20:38:26 2015 -0600 @@ -18,7 +18,16 @@ } Object arithmetic(LuanStateImpl luan,String op,Object o1,Object o2) throws LuanException { - return luan.bit(el()).arithmetic(op,o1,o2); + luan.push(el,null); + try { + LuanFunction fn = luan.getBinHandler(op,o1,o2); + if( fn != null ) + return Luan.first(fn.call(luan,new Object[]{o1,o2})); + String type = !(o1 instanceof Number) ? Luan.type(o1) : Luan.type(o2); + throw luan.exception("attempt to perform arithmetic on a "+type+" value"); + } finally { + luan.pop(); + } } }