Mercurial Hosting > luan
comparison 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 |
comparison
equal
deleted
inserted
replaced
575:7c3ad6db8ac3 | 576:4723d22062ce |
---|---|
16 this.op1 = op1; | 16 this.op1 = op1; |
17 this.op2 = op2; | 17 this.op2 = op2; |
18 } | 18 } |
19 | 19 |
20 Object arithmetic(LuanStateImpl luan,String op,Object o1,Object o2) throws LuanException { | 20 Object arithmetic(LuanStateImpl luan,String op,Object o1,Object o2) throws LuanException { |
21 return luan.bit(el()).arithmetic(op,o1,o2); | 21 luan.push(el,null); |
22 try { | |
23 LuanFunction fn = luan.getBinHandler(op,o1,o2); | |
24 if( fn != null ) | |
25 return Luan.first(fn.call(luan,new Object[]{o1,o2})); | |
26 String type = !(o1 instanceof Number) ? Luan.type(o1) : Luan.type(o2); | |
27 throw luan.exception("attempt to perform arithmetic on a "+type+" value"); | |
28 } finally { | |
29 luan.pop(); | |
30 } | |
22 } | 31 } |
23 | 32 |
24 } | 33 } |