Mercurial Hosting > luan
comparison core/src/luan/impl/EqExpr.java @ 576:4723d22062ce
remove LuanBit
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 13 Jul 2015 20:38:26 -0600 |
parents | b48cfa14ba60 |
children | 859c0dedc8b6 |
comparison
equal
deleted
inserted
replaced
575:7c3ad6db8ac3 | 576:4723d22062ce |
---|---|
4 import luan.Luan; | 4 import luan.Luan; |
5 import luan.LuanFunction; | 5 import luan.LuanFunction; |
6 import luan.LuanTable; | 6 import luan.LuanTable; |
7 import luan.LuanException; | 7 import luan.LuanException; |
8 import luan.LuanElement; | 8 import luan.LuanElement; |
9 import luan.LuanBit; | |
10 | 9 |
11 | 10 |
12 final class EqExpr extends BinaryOpExpr { | 11 final class EqExpr extends BinaryOpExpr { |
13 | 12 |
14 EqExpr(LuanElement el,Expr op1,Expr op2) { | 13 EqExpr(LuanElement el,Expr op1,Expr op2) { |
43 if( mt1==null || mt2==null ) | 42 if( mt1==null || mt2==null ) |
44 return false; | 43 return false; |
45 Object f = mt1.rawGet("__eq"); | 44 Object f = mt1.rawGet("__eq"); |
46 if( f == null || !f.equals(mt2.rawGet("__eq")) ) | 45 if( f == null || !f.equals(mt2.rawGet("__eq")) ) |
47 return false; | 46 return false; |
48 LuanBit bit = luan.bit(el); | 47 luan.push(el,"__eq"); |
49 LuanFunction fn = bit.checkFunction(f); | 48 try { |
50 return bit.checkBoolean( Luan.first(bit.call(fn,"__eq",new Object[]{o1,o2})) ); | 49 LuanFunction fn = luan.checkFunction(f); |
50 return luan.checkBoolean( Luan.first(fn.call(luan,new Object[]{o1,o2})) ); | |
51 } finally { | |
52 luan.pop(); | |
53 } | |
51 } | 54 } |
52 | 55 |
53 @Override public String toString() { | 56 @Override public String toString() { |
54 return "(EqExpr "+op1+" "+op2+")"; | 57 return "(EqExpr "+op1+" "+op2+")"; |
55 } | 58 } |