Skip to content

Commit 25f561e

Browse files
committed
[[ Compiler ]] Fix output of position info (was previously handler relative addresses, rather than global).
1 parent 2a84892 commit 25f561e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libscript/src/script-builder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,8 @@ void MCScriptEndHandlerInModule(MCScriptModuleBuilderRef self)
11431143
t_operands[t_address_index] = (1 << 31) | t_encoded_target_address;
11441144
}
11451145

1146+
uindex_t t_pos_address_offset;
1147+
t_pos_address_offset = self -> module . bytecode_count;
11461148
for(uindex_t i = 0; i < self -> instruction_count; i++)
11471149
{
11481150
MCScriptBytecodeOp t_op;
@@ -1154,7 +1156,7 @@ void MCScriptEndHandlerInModule(MCScriptModuleBuilderRef self)
11541156
t_arity = self -> instructions[i] . arity;
11551157
t_operands = &self -> operands[self -> instructions[i] . operands];
11561158

1157-
__emit_position(self, t_address, self -> instructions[i] . file, self -> instructions[i] . line);
1159+
__emit_position(self, t_pos_address_offset + t_address, self -> instructions[i] . file, self -> instructions[i] . line);
11581160

11591161
__emit_bytecode_byte(self, t_op | (MCMin(t_arity, 15) << 4));
11601162

0 commit comments

Comments
 (0)