Mercurial Hosting > luan
comparison core/src/luan/impl/ConcatExpr.java @ 576:4723d22062ce
remove LuanBit
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 13 Jul 2015 20:38:26 -0600 |
parents | f1601a4ce1aa |
children | 859c0dedc8b6 |
comparison
equal
deleted
inserted
replaced
575:7c3ad6db8ac3 | 576:4723d22062ce |
---|---|
2 | 2 |
3 import luan.Luan; | 3 import luan.Luan; |
4 import luan.LuanFunction; | 4 import luan.LuanFunction; |
5 import luan.LuanException; | 5 import luan.LuanException; |
6 import luan.LuanElement; | 6 import luan.LuanElement; |
7 import luan.LuanBit; | |
8 | 7 |
9 | 8 |
10 final class ConcatExpr extends BinaryOpExpr { | 9 final class ConcatExpr extends BinaryOpExpr { |
11 | 10 |
12 ConcatExpr(LuanElement el,Expr op1,Expr op2) { | 11 ConcatExpr(LuanElement el,Expr op1,Expr op2) { |
14 } | 13 } |
15 | 14 |
16 @Override public Object eval(LuanStateImpl luan) throws LuanException { | 15 @Override public Object eval(LuanStateImpl luan) throws LuanException { |
17 Object o1 = op1.eval(luan); | 16 Object o1 = op1.eval(luan); |
18 Object o2 = op2.eval(luan); | 17 Object o2 = op2.eval(luan); |
19 LuanBit bit = luan.bit(el); | 18 luan.push(el,null); |
20 LuanFunction fn = bit.getBinHandler("__concat",o1,o2); | 19 try { |
21 if( fn != null ) | 20 LuanFunction fn = luan.getBinHandler("__concat",o1,o2); |
22 return Luan.first(bit.call(fn,"__concat",new Object[]{o1,o2})); | 21 if( fn != null ) |
23 String s1 = luan.bit(op1.el()).toString(o1); | 22 return Luan.first(fn.call(luan,new Object[]{o1,o2})); |
24 String s2 = luan.bit(op2.el()).toString(o2); | 23 } finally { |
24 luan.pop(); | |
25 } | |
26 String s1 = luan.toString(o1,op1.el()); | |
27 String s2 = luan.toString(o2,op2.el()); | |
25 return s1 + s2; | 28 return s1 + s2; |
26 } | 29 } |
27 } | 30 } |