diff --git a/ts2panda/src/compiler.ts b/ts2panda/src/compiler.ts index a2f0d17374f11e69e9884f0c7a8f8428eb62df46..0d706fc8f9ebcf9935b882ff1a48efd604c990da 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(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); } } } diff --git a/ts2panda/src/function/asyncFunctionBuilder.ts b/ts2panda/src/function/asyncFunctionBuilder.ts index 5c29ae1f70095b9771722685ee45000b46087559..b38543fa6c0a81fe0890e9d40f132e5ea0fa9887 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 5801ef08e87ac18cfb3a97b4478764716cb4d490..1de654753cfb75db8246049a2d3622877c4c0874 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) { @@ -997,7 +997,7 @@ export class PandaGen { this.add(node, new EcmaGetresumemode(genObj)); } - asyncFunctionEnter(node: ts.Node) { + asyncFunctionEnter(node: ts.Node | NodeKind) { this.add(node, new EcmaAsyncfunctionenter()); }