From 35db92066ef53d42a26299519ed6b28751c5338f Mon Sep 17 00:00:00 2001 From: zhangrengao Date: Wed, 6 Apr 2022 09:12:38 +0800 Subject: [PATCH 1/2] fix function bug of stepover Signed-off-by: zhangrengao Change-Id: Ib40b26d2be94778d5ef489d9f50a493729374538 --- ts2panda/src/compiler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ts2panda/src/compiler.ts b/ts2panda/src/compiler.ts index 9f7bc7fc8d..a3f75d60ec 100644 --- a/ts2panda/src/compiler.ts +++ b/ts2panda/src/compiler.ts @@ -241,8 +241,8 @@ export class Compiler { let funcName = jshelpers.getTextOfIdentifierOrLiteral((rootNode).name); let v = functionScope.find(funcName); if (v.scope == functionScope) { - this.pandaGen.loadAccumulator(rootNode, getVregisterCache(this.pandaGen, CacheList.FUNC)); - this.pandaGen.storeAccToLexEnv(rootNode, v.scope, v.level, v.v, true); + this.pandaGen.loadAccumulator(NodeKind.FirstNodeOfFunction, getVregisterCache(this.pandaGen, CacheList.FUNC)); + this.pandaGen.storeAccToLexEnv(NodeKind.FirstNodeOfFunction, v.scope, v.level, v.v, true); } } } -- Gitee From e805405b929b97018430a7edca7e32cb1ed46d69 Mon Sep 17 00:00:00 2001 From: zhangrengao Date: Mon, 11 Apr 2022 09:20:32 +0800 Subject: [PATCH 2/2] fix label of stepover Signed-off-by: zhangrengao Change-Id: I788ecf5bda749db507cc60a40f17df9170a11afd --- ts2panda/src/function/asyncFunctionBuilder.ts | 4 ++-- ts2panda/src/pandagen.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ts2panda/src/function/asyncFunctionBuilder.ts b/ts2panda/src/function/asyncFunctionBuilder.ts index 5c29ae1f70..b38543fa6c 100644 --- a/ts2panda/src/function/asyncFunctionBuilder.ts +++ b/ts2panda/src/function/asyncFunctionBuilder.ts @@ -48,8 +48,8 @@ export class AsyncFunctionBuilder { prepare(node: ts.Node): void { let pandaGen = this.pandaGen; - pandaGen.asyncFunctionEnter(node); - pandaGen.storeAccumulator(node, this.asyncObj); + pandaGen.asyncFunctionEnter(NodeKind.Invalid); + pandaGen.storeAccumulator(NodeKind.Invalid, this.asyncObj); pandaGen.label(node, this.beginLabel); } diff --git a/ts2panda/src/pandagen.ts b/ts2panda/src/pandagen.ts index eae6caebd1..ad0237aa79 100644 --- a/ts2panda/src/pandagen.ts +++ b/ts2panda/src/pandagen.ts @@ -659,7 +659,7 @@ export class PandaGen { // @ts-ignore label(node: ts.Node, label: Label) { - this.add(NodeKind.FirstNodeOfFunction, label); + this.add(NodeKind.Invalid, label); } branch(node: ts.Node | NodeKind, target: Label) { @@ -993,7 +993,7 @@ export class PandaGen { this.add(node, new EcmaGetresumemode(genObj)); } - asyncFunctionEnter(node: ts.Node) { + asyncFunctionEnter(node: ts.Node | NodeKind) { this.add(node, new EcmaAsyncfunctionenter()); } -- Gitee