Mercurial Hosting > luan
comparison src/luan/impl/ConcatExpr.java @ 166:4eaee12f6c65
move luan/interp to impl
git-svn-id: https://luan-java.googlecode.com/svn/trunk@167 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Sun, 22 Jun 2014 04:17:38 +0000 |
parents | src/luan/interp/ConcatExpr.java@6ca02b188dba |
children |
comparison
equal
deleted
inserted
replaced
165:94bbc4cbc106 | 166:4eaee12f6c65 |
---|---|
1 package luan.impl; | |
2 | |
3 import luan.Luan; | |
4 import luan.LuanFunction; | |
5 import luan.LuanException; | |
6 import luan.LuanSource; | |
7 | |
8 | |
9 final class ConcatExpr extends BinaryOpExpr { | |
10 | |
11 ConcatExpr(LuanSource.Element se,Expr op1,Expr op2) { | |
12 super(se,op1,op2); | |
13 } | |
14 | |
15 @Override public Object eval(LuanStateImpl luan) throws LuanException { | |
16 Object o1 = op1.eval(luan); | |
17 Object o2 = op2.eval(luan); | |
18 String s1 = luan.bit(op1.se()).toString(o1); | |
19 String s2 = luan.bit(op2.se()).toString(o2); | |
20 /* | |
21 if( s1 != null && s2 != null ) | |
22 return s1 + s2; | |
23 LuanFunction fn = luan.getBinHandler(se,"__concat",o1,o2); | |
24 if( fn != null ) | |
25 return Luan.first(luan.call(fn,se,"__concat",o1,o2)); | |
26 String type = s1==null ? Luan.type(o1) : Luan.type(o2); | |
27 throw new LuanException( luan, se, "attempt to concatenate a " + type + " value" ); | |
28 */ | |
29 return s1 + s2; | |
30 } | |
31 } |