Mercurial Hosting > luan
comparison core/src/luan/impl/ConcatExpr.java @ 645:859c0dedc8b6
remove LuanSource
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 29 Mar 2016 18:09:51 -0600 |
parents | 4723d22062ce |
children | 8e8c30b72e9b |
comparison
equal
deleted
inserted
replaced
644:ba1e318377c5 | 645:859c0dedc8b6 |
---|---|
1 package luan.impl; | 1 package luan.impl; |
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; | |
7 | 6 |
8 | 7 |
9 final class ConcatExpr extends BinaryOpExpr { | 8 final class ConcatExpr extends BinaryOpExpr { |
10 | 9 |
11 ConcatExpr(LuanElement el,Expr op1,Expr op2) { | 10 ConcatExpr(Expr op1,Expr op2) { |
12 super(el,op1,op2); | 11 super(op1,op2); |
13 } | 12 } |
14 | 13 |
15 @Override public Object eval(LuanStateImpl luan) throws LuanException { | 14 @Override public Object eval(LuanStateImpl luan) throws LuanException { |
16 Object o1 = op1.eval(luan); | 15 Object o1 = op1.eval(luan); |
17 Object o2 = op2.eval(luan); | 16 Object o2 = op2.eval(luan); |
18 luan.push(el,null); | 17 LuanFunction fn = luan.getBinHandler("__concat",o1,o2); |
19 try { | 18 if( fn != null ) |
20 LuanFunction fn = luan.getBinHandler("__concat",o1,o2); | 19 return Luan.first(fn.call(luan,new Object[]{o1,o2})); |
21 if( fn != null ) | 20 String s1 = luan.toString(o1); |
22 return Luan.first(fn.call(luan,new Object[]{o1,o2})); | 21 String s2 = luan.toString(o2); |
23 } finally { | |
24 luan.pop(); | |
25 } | |
26 String s1 = luan.toString(o1,op1.el()); | |
27 String s2 = luan.toString(o2,op2.el()); | |
28 return s1 + s2; | 22 return s1 + s2; |
29 } | 23 } |
30 } | 24 } |