diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-21 11:30:15 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-21 11:30:15 -0200 |
| commit | 96ea2e0fb462789015824823801ba34782364b68 (patch) | |
| tree | 4d8a4a0792a8fd51f16cf00af347b45313ccdc87 /opcode.c | |
| parent | 93ccdd52ef83e283f7357c7e9de3a8773b26a16d (diff) | |
| download | lua-96ea2e0fb462789015824823801ba34782364b68.tar.gz lua-96ea2e0fb462789015824823801ba34782364b68.tar.bz2 lua-96ea2e0fb462789015824823801ba34782364b68.zip | |
fallback to unary minus is 'arith' with operation code 'unm'
Diffstat (limited to 'opcode.c')
| -rw-r--r-- | opcode.c | 7 |
1 files changed, 5 insertions, 2 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** TecCGraf - PUC-Rio | 3 | ** TecCGraf - PUC-Rio |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_opcode="$Id: opcode.c,v 3.17 1994/11/17 21:23:43 roberto Exp roberto $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 3.18 1994/11/18 19:46:21 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | #include <setjmp.h> | 8 | #include <setjmp.h> |
| 9 | #include <stdio.h> | 9 | #include <stdio.h> |
| @@ -989,7 +989,10 @@ static int lua_execute (Byte *pc, int base) | |||
| 989 | 989 | ||
| 990 | case MINUSOP: | 990 | case MINUSOP: |
| 991 | if (tonumber(top-1)) | 991 | if (tonumber(top-1)) |
| 992 | do_call(&luaI_fallBacks[FB_UNMINUS].function, (top-stack)-1, 1, (top-stack)-1); | 992 | { |
| 993 | tag(top++) = LUA_T_NIL; | ||
| 994 | call_arith("unm"); | ||
| 995 | } | ||
| 993 | else | 996 | else |
| 994 | nvalue(top-1) = - nvalue(top-1); | 997 | nvalue(top-1) = - nvalue(top-1); |
| 995 | break; | 998 | break; |
