aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-12-06 12:27:18 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1994-12-06 12:27:18 -0200
commitce4fb88b34421bc4426db7985314ba7ed757a284 (patch)
tree921c78d349d466295e30d467fce40cf7d60b7c3c
parente742d542534637c7c64e7acd461512c80646a475 (diff)
downloadlua-ce4fb88b34421bc4426db7985314ba7ed757a284.tar.gz
lua-ce4fb88b34421bc4426db7985314ba7ed757a284.tar.bz2
lua-ce4fb88b34421bc4426db7985314ba7ed757a284.zip
opcode PUSHSELF has a parameter that indicates the method to be called
-rw-r--r--lua.stx15
-rw-r--r--opcode.c7
2 files changed, 16 insertions, 6 deletions
diff --git a/lua.stx b/lua.stx
index bd61cfb7..2dd21a3c 100644
--- a/lua.stx
+++ b/lua.stx
@@ -1,6 +1,6 @@
1%{ 1%{
2 2
3char *rcs_luastx = "$Id: lua.stx,v 3.11 1994/11/23 14:39:52 roberto Stab roberto $"; 3char *rcs_luastx = "$Id: lua.stx,v 3.12 1994/11/25 19:24:57 roberto Exp $";
4 4
5#include <stdio.h> 5#include <stdio.h>
6#include <stdlib.h> 6#include <stdlib.h>
@@ -418,9 +418,8 @@ functioncall : funcvalue funcParams
418funcvalue : varexp { $$ = 0; } 418funcvalue : varexp { $$ = 0; }
419 | varexp ':' NAME 419 | varexp ':' NAME
420 { 420 {
421 code_byte(PUSHSTRING);
422 code_word(luaI_findconstant($3));
423 code_byte(PUSHSELF); 421 code_byte(PUSHSELF);
422 code_word(luaI_findconstant($3));
424 $$ = 1; 423 $$ = 1;
425 } 424 }
426 ; 425 ;
@@ -830,7 +829,15 @@ static void PrintCode (Byte *code, Byte *end)
830 printf ("%d STOREGLOBAL %d\n", n, c.w); 829 printf ("%d STOREGLOBAL %d\n", n, c.w);
831 } 830 }
832 break; 831 break;
833 case PUSHSELF: printf ("%d PUSHSELF\n", (p++)-code); break; 832 case PUSHSELF:
833 {
834 CodeWord c;
835 int n = p-code;
836 p++;
837 get_word(c,p);
838 printf ("%d PUSHSELF %d\n", n, c.w);
839 }
840 break;
834 case STOREINDEXED0: printf ("%d STOREINDEXED0\n", (p++)-code); break; 841 case STOREINDEXED0: printf ("%d STOREINDEXED0\n", (p++)-code); break;
835 case STOREINDEXED: printf ("%d STOREINDEXED %d\n", p-code, *(++p)); 842 case STOREINDEXED: printf ("%d STOREINDEXED %d\n", p-code, *(++p));
836 p++; 843 p++;
diff --git a/opcode.c b/opcode.c
index a6945ced..64dcca68 100644
--- a/opcode.c
+++ b/opcode.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_opcode="$Id: opcode.c,v 3.22 1994/11/23 14:31:11 roberto Stab roberto $"; 6char *rcs_opcode="$Id: opcode.c,v 3.23 1994/11/30 21:20:37 roberto Exp roberto $";
7 7
8#include <setjmp.h> 8#include <setjmp.h>
9#include <stdio.h> 9#include <stdio.h>
@@ -803,7 +803,10 @@ static int lua_execute (Byte *pc, int base)
803 803
804 case PUSHSELF: 804 case PUSHSELF:
805 { 805 {
806 Object receiver = *(top-2); 806 Object receiver = *(top-1);
807 CodeWord code;
808 get_word(code,pc);
809 tag(top) = LUA_T_STRING; tsvalue(top++) = lua_constant[code.w];
807 pushsubscript(); 810 pushsubscript();
808 *(top++) = receiver; 811 *(top++) = receiver;
809 break; 812 break;