From 8272b0526b3390cd38447fb3cac6fa366425dc9c Mon Sep 17 00:00:00 2001 From: qiuyu Date: Tue, 8 Nov 2022 16:59:28 +0800 Subject: [PATCH] Bugfix for ScopeInsIndex Bugfix for ScopeInsIndex Issue: #I603TB Signed-off-by: qiuyu Change-Id: Ibe528ee77ea9f816b6b14daee5eb5a954ad277a0 --- ts2panda/src/debuginfo.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ts2panda/src/debuginfo.ts b/ts2panda/src/debuginfo.ts index c2eadc9110..40d9535c24 100644 --- a/ts2panda/src/debuginfo.ts +++ b/ts2panda/src/debuginfo.ts @@ -309,13 +309,17 @@ export class DebugInfo { ( insns[i]).getScope().setScopeStartInsIdx(i); // delete ins placeholder insns.splice(i, 1); - i--; + if (i > 0) { + i--; + } } if (insns[i] instanceof DebugInsEndPlaceHolder) { - ( insns[i]).getScope().setScopeEndInsIdx(i); + ( insns[i]).getScope().setScopeEndInsIdx(i > 0 ? i - 1 : 0); // delete ins placeholder insns.splice(i, 1); - i--; + if (i > 0) { + i--; + } } } -- Gitee