comparison core/src/luan/impl/BinaryOpExpr.java @ 646:cdc70de628b5

simplify LuanException
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 29 Mar 2016 19:58:39 -0600
parents 859c0dedc8b6
children 8e8c30b72e9b
comparison
equal deleted inserted replaced
645:859c0dedc8b6 646:cdc70de628b5
18 Object arithmetic(LuanStateImpl luan,String op,Object o1,Object o2) throws LuanException { 18 Object arithmetic(LuanStateImpl luan,String op,Object o1,Object o2) throws LuanException {
19 LuanFunction fn = luan.getBinHandler(op,o1,o2); 19 LuanFunction fn = luan.getBinHandler(op,o1,o2);
20 if( fn != null ) 20 if( fn != null )
21 return Luan.first(fn.call(luan,new Object[]{o1,o2})); 21 return Luan.first(fn.call(luan,new Object[]{o1,o2}));
22 String type = !(o1 instanceof Number) ? Luan.type(o1) : Luan.type(o2); 22 String type = !(o1 instanceof Number) ? Luan.type(o1) : Luan.type(o2);
23 throw new LuanException(luan,"attempt to perform arithmetic on a "+type+" value"); 23 throw new LuanException("attempt to perform arithmetic on a "+type+" value");
24 } 24 }
25 25
26 } 26 }