Mercurial Hosting > luan
view core/src/luan/impl/MulExpr.java @ 336:8ce291137e8d
README.md edited online with Bitbucket
author | Hugo Teixeira <hugo.tech@gmail.com> |
---|---|
date | Wed, 25 Mar 2015 04:29:03 +0000 |
parents | 3dcb0f9bee82 |
children | bbad2d06f728 |
line wrap: on
line source
package luan.impl; import luan.Luan; import luan.LuanException; import luan.LuanSource; final class MulExpr extends BinaryOpExpr { MulExpr(LuanSource.Element se,Expr op1,Expr op2) { super(se,op1,op2); } @Override public Object eval(LuanStateImpl luan) throws LuanException { Object o1 = op1.eval(luan); Object o2 = op2.eval(luan); Number n1 = Luan.toNumber(o1); Number n2 = Luan.toNumber(o2); if( n1 != null && n2 != null ) return n1.doubleValue() * n2.doubleValue(); return arithmetic(luan,"__mul",o1,o2); } }