diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-06 14:30:55 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-06 14:30:55 -0300 |
commit | b8af9c56c95722e7a3289f02568b9e2a7495c484 (patch) | |
tree | 463f99205e403ff0790dc7dc7a4fd7ab0676f935 /opcode.c | |
parent | c3c0b52a1f1318c3b1131d260100ad9d999db5d5 (diff) | |
download | lua-b8af9c56c95722e7a3289f02568b9e2a7495c484.tar.gz lua-b8af9c56c95722e7a3289f02568b9e2a7495c484.tar.bz2 lua-b8af9c56c95722e7a3289f02568b9e2a7495c484.zip |
new form for constructors: {[exp] = exp, ...}
Diffstat (limited to 'opcode.c')
-rw-r--r-- | opcode.c | 14 |
1 files changed, 12 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.81 1997/02/20 15:51:14 roberto Exp roberto $"; | 6 | char *rcs_opcode="$Id: opcode.c,v 3.82 1997/02/26 17:38:41 roberto Unstable roberto $"; |
7 | 7 | ||
8 | #include <setjmp.h> | 8 | #include <setjmp.h> |
9 | #include <stdio.h> | 9 | #include <stdio.h> |
@@ -1184,7 +1184,7 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
1184 | } | 1184 | } |
1185 | break; | 1185 | break; |
1186 | 1186 | ||
1187 | case STORERECORD: | 1187 | case STORERECORD: /* opcode obsolete: supersed by STOREMAP */ |
1188 | { | 1188 | { |
1189 | int n = *(pc++); | 1189 | int n = *(pc++); |
1190 | Object *arr = top-n-1; | 1190 | Object *arr = top-n-1; |
@@ -1200,6 +1200,16 @@ static StkId lua_execute (Byte *pc, StkId base) | |||
1200 | } | 1200 | } |
1201 | break; | 1201 | break; |
1202 | 1202 | ||
1203 | case STOREMAP: { | ||
1204 | int n = *(pc++); | ||
1205 | Object *arr = top-(2*n)-1; | ||
1206 | while (n--) { | ||
1207 | *(lua_hashdefine (avalue(arr), top-2)) = *(top-1); | ||
1208 | top-=2; | ||
1209 | } | ||
1210 | } | ||
1211 | break; | ||
1212 | |||
1203 | case ADJUST0: | 1213 | case ADJUST0: |
1204 | adjust_top(base); | 1214 | adjust_top(base); |
1205 | break; | 1215 | break; |