Skip to content

Commit 57a57a4

Browse files
committed
- Initial code for scope-based resource handling
1 parent e5de5c6 commit 57a57a4

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

core/opcode.cc

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ const char* get_opcode_name(Opcode opnum)
6363
case OP_SUBSCRIPT_W: return "subsw";
6464
case OP_SUBSCRIPT_R: return "subsr";
6565
case OP_BIND: return "bind";
66+
case OP_BSCOPE: return "bscope";
67+
case OP_ESCOPE: return "escope";
6668
EMPTY_SWITCH_DEFAULT_CASE();
6769
}
6870
#undef CASE

core/opcode.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ namespace clever {
6060
&&OP_BW_RS, \
6161
&&OP_SUBSCRIPT_W,\
6262
&&OP_SUBSCRIPT_R,\
63-
&&OP_BIND
63+
&&OP_BIND, \
64+
&&OP_BSCOPE, \
65+
&&OP_ESCOPE
6466
#endif
6567

6668
/// VM opcodes
@@ -114,6 +116,8 @@ enum Opcode {
114116
OP_SUBSCRIPT_W,// Used for subscript operator (write mode)
115117
OP_SUBSCRIPT_R,// Used for subscript operator (read mode)
116118
OP_BIND, // Used for runtime binding
119+
OP_BSCOPE, // Used for begin scope marker
120+
OP_ESCOPE, // 50 - Used for end scope marker
117121
NUM_OPCODES
118122
};
119123

core/vm.cc

+6
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,12 @@ void VM::run()
983983
}
984984
DISPATCH;
985985

986+
OP(OP_BSCOPE):
987+
DISPATCH;
988+
989+
OP(OP_ESCOPE):
990+
DISPATCH;
991+
986992
OP(OP_HALT): goto exit;
987993
END_OPCODES;
988994

0 commit comments

Comments
 (0)