From 8d0d63a241d2fdad5ba96788bb6f724fb14f6036 Mon Sep 17 00:00:00 2001 From: zhangrengao Date: Fri, 6 May 2022 21:33:55 +0800 Subject: [PATCH] fix firstnode of uninitial ins Signed-off-by: zhangrengao Change-Id: I4d757438e57fe825ff9c7ab79c3f6f408e924033 --- ts2panda/src/compiler.ts | 4 ++-- ts2panda/src/debuginfo.ts | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ts2panda/src/compiler.ts b/ts2panda/src/compiler.ts index 0d311fcb7a..3271653c0c 100644 --- a/ts2panda/src/compiler.ts +++ b/ts2panda/src/compiler.ts @@ -240,8 +240,8 @@ export class Compiler { let funcName = jshelpers.getTextOfIdentifierOrLiteral((rootNode).name); let v = functionScope.find(funcName); if (v.scope == functionScope) { - this.pandaGen.loadAccumulator(NodeKind.FirstNodeOfFunction, getVregisterCache(this.pandaGen, CacheList.FUNC)); - this.pandaGen.storeAccToLexEnv(NodeKind.FirstNodeOfFunction, v.scope, v.level, v.v, true); + this.pandaGen.loadAccumulator(NodeKind.Invalid, getVregisterCache(this.pandaGen, CacheList.FUNC)); + this.pandaGen.storeAccToLexEnv(NodeKind.Invalid, v.scope, v.level, v.v, true); } } } diff --git a/ts2panda/src/debuginfo.ts b/ts2panda/src/debuginfo.ts index 0eff7e3c0d..6cd35350e9 100644 --- a/ts2panda/src/debuginfo.ts +++ b/ts2panda/src/debuginfo.ts @@ -193,6 +193,11 @@ export class DebugInfo { } } + public static setInvalidPosInfoForUninitializeIns(posInfo: DebugPosInfo, pandaGen: PandaGen) { + posInfo.setSourecLineNum(-1); + posInfo.setSourecColumnNum(-1); + } + public static addScope(scope: Scope) { DebugInfo.scopeArray.push(scope); } @@ -277,7 +282,7 @@ export class DebugInfo { // count pos offset for (let i = 0; i < insns.length; i++) { if (insns[i].debugPosInfo.getDebugPosInfoNodeState() == NodeKind.FirstNodeOfFunction) { - DebugInfo.setPosInfoForUninitializeIns(insns[i].debugPosInfo, pandaGen); + DebugInfo.setInvalidPosInfoForUninitializeIns(insns[i].debugPosInfo, pandaGen); } let insLength = DebugInfo.getIRNodeWholeLength(insns[i]); -- Gitee