From bc4061cc913cac665e8abe26cfe4c804affd122e 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 b49a58105a..7e95232598 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