comparison src/luan/interp/UnmExpr.java @ 31:5cf15507d77e

separate interpreter from interface git-svn-id: https://luan-java.googlecode.com/svn/trunk@32 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Thu, 13 Dec 2012 02:50:04 +0000
parents b7d7069fee58
children e51906de0f11
comparison
equal deleted inserted replaced
30:8d8f4f5caef4 31:5cf15507d77e
1 package luan.interp; 1 package luan.interp;
2 2
3 import luan.Lua; 3 import luan.Lua;
4 import luan.LuaNumber; 4 import luan.LuaNumber;
5 import luan.LuaException; 5 import luan.LuaException;
6 import luan.LuaState;
7 6
8 7
9 // unary minus 8 // unary minus
10 final class UnmExpr extends UnaryOpExpr { 9 final class UnmExpr extends UnaryOpExpr {
11 10
12 UnmExpr(Expr op) { 11 UnmExpr(Expr op) {
13 super(op); 12 super(op);
14 } 13 }
15 14
16 @Override public Object eval(LuaState lua) throws LuaException { 15 @Override public Object eval(LuaStateImpl lua) throws LuaException {
17 double n = Lua.checkNumber(op.eval(lua)).value(); 16 double n = Lua.checkNumber(op.eval(lua)).value();
18 return new LuaNumber( -n ); 17 return new LuaNumber( -n );
19 } 18 }
20 } 19 }