From a31452e971acaa63249435334d676eb502a983b6 Mon Sep 17 00:00:00 2001 From: jtuu Date: Fri, 1 May 2020 07:20:43 +0300 Subject: [PATCH] InstructionPointer.prototype.source_location now returns the source location for instructions whose mnemonic doesn't exist in the source code but have arguments that do. --- src/quest_editor/QuestRunner.ts | 8 +------- src/quest_editor/scripting/vm/InstructionPointer.ts | 2 +- src/quest_editor/scripting/vm/VirtualMachine.ts | 8 +------- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/quest_editor/QuestRunner.ts b/src/quest_editor/QuestRunner.ts index 3612e71e..b26df36b 100644 --- a/src/quest_editor/QuestRunner.ts +++ b/src/quest_editor/QuestRunner.ts @@ -221,13 +221,7 @@ export class QuestRunner { // Exists in source? if (ip && ip.source_location) { this._pause_location.val = ip.source_location.line_no; - } - // No source location. Belongs to another instruction? - else if (ip && ip.instruction.asm && ip.instruction.asm.args.length > 0) { - this._pause_location.val = ip.instruction.asm.args[0].line_no; - } - // No source location can be inferred. - else { + } else { this._pause_location.val = undefined; } } diff --git a/src/quest_editor/scripting/vm/InstructionPointer.ts b/src/quest_editor/scripting/vm/InstructionPointer.ts index fc7def4a..e5f497ab 100644 --- a/src/quest_editor/scripting/vm/InstructionPointer.ts +++ b/src/quest_editor/scripting/vm/InstructionPointer.ts @@ -43,7 +43,7 @@ export class InstructionPointer { } get source_location(): AsmToken | undefined { - return this.instruction.asm?.mnemonic; + return this.instruction.asm?.mnemonic || this.instruction.asm?.args[0]; } /** diff --git a/src/quest_editor/scripting/vm/VirtualMachine.ts b/src/quest_editor/scripting/vm/VirtualMachine.ts index 09844356..c2d10799 100644 --- a/src/quest_editor/scripting/vm/VirtualMachine.ts +++ b/src/quest_editor/scripting/vm/VirtualMachine.ts @@ -495,13 +495,7 @@ export class VirtualMachine { // Exists in source? if (ip && ip.source_location) { this.ignore_pauses_until_after_line = ip.source_location.line_no; - } - // No source location. Belongs to another instruction? - else if (ip && ip.instruction.asm && ip.instruction.asm.args.length > 0) { - this.ignore_pauses_until_after_line = ip.instruction.asm.args[0].line_no; - } - // No source location can be inferred. - else { + } else { this.ignore_pauses_until_after_line = undefined; } }