diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-09 15:26:46 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-09 15:26:46 +0100 |
commit | 2bf7c092225645d8c5b15e536afdce39e3593e42 (patch) | |
tree | e257514a3008411367ea5e62eaea4b101ccac257 /py/bc0.h | |
parent | 11d8cd54c992eee55f27d3779738626bdc095c03 (diff) |
py: Properly implement deletion of locals and derefs, and detect errors.
Needed to reinstate 2 delete opcodes, to specifically check that a local
is not deleted twice.
Diffstat (limited to 'py/bc0.h')
-rw-r--r-- | py/bc0.h | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -1,10 +1,6 @@ // Micro Python byte-codes. // The comment at the end of the line (if it exists) tells the arguments to the byte-code. -// TODO Add MP_BC_LOAD_FAST_CHECKED and MP_BC_STORE_FAST_CHECKED for acting on those -// locals which have del called on them anywhere in the function. -// UnboundLocalError: local variable '%s' referenced before assignment - #define MP_BC_LOAD_CONST_FALSE (0x10) #define MP_BC_LOAD_CONST_NONE (0x11) #define MP_BC_LOAD_CONST_TRUE (0x12) @@ -21,12 +17,13 @@ #define MP_BC_LOAD_FAST_1 (0x21) #define MP_BC_LOAD_FAST_2 (0x22) #define MP_BC_LOAD_FAST_N (0x23) // uint -#define MP_BC_LOAD_DEREF (0x24) // uint -#define MP_BC_LOAD_NAME (0x25) // qstr -#define MP_BC_LOAD_GLOBAL (0x26) // qstr -#define MP_BC_LOAD_ATTR (0x27) // qstr -#define MP_BC_LOAD_METHOD (0x28) // qstr -#define MP_BC_LOAD_BUILD_CLASS (0x29) +#define MP_BC_LOAD_FAST_CHECKED (0x24) // uint +#define MP_BC_LOAD_DEREF (0x25) // uint +#define MP_BC_LOAD_NAME (0x26) // qstr +#define MP_BC_LOAD_GLOBAL (0x27) // qstr +#define MP_BC_LOAD_ATTR (0x28) // qstr +#define MP_BC_LOAD_METHOD (0x29) // qstr +#define MP_BC_LOAD_BUILD_CLASS (0x2a) #define MP_BC_STORE_FAST_0 (0x30) #define MP_BC_STORE_FAST_1 (0x31) @@ -38,8 +35,10 @@ #define MP_BC_STORE_ATTR (0x37) // qstr #define MP_BC_STORE_SUBSCR (0x38) -#define MP_BC_DELETE_NAME (0x39) // qstr -#define MP_BC_DELETE_GLOBAL (0x3a) // qstr +#define MP_BC_DELETE_FAST (0x39) // uint +#define MP_BC_DELETE_DEREF (0x3a) // uint +#define MP_BC_DELETE_NAME (0x3b) // qstr +#define MP_BC_DELETE_GLOBAL (0x3c) // qstr #define MP_BC_DUP_TOP (0x40) #define MP_BC_DUP_TOP_TWO (0x41) |