diff --git a/ts2panda/src/compiler.ts b/ts2panda/src/compiler.ts index a3f75d60ec0f40d7fbb5dc6d948d0b47db78aef2..9f7bc7fc8d49fd2411156d2a8793067100e05c0c 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(NodeKind.FirstNodeOfFunction, getVregisterCache(this.pandaGen, CacheList.FUNC)); - this.pandaGen.storeAccToLexEnv(NodeKind.FirstNodeOfFunction, v.scope, v.level, v.v, true); + this.pandaGen.loadAccumulator(rootNode, getVregisterCache(this.pandaGen, CacheList.FUNC)); + this.pandaGen.storeAccToLexEnv(rootNode, v.scope, v.level, v.v, true); } } } diff --git a/ts2panda/src/function/asyncFunctionBuilder.ts b/ts2panda/src/function/asyncFunctionBuilder.ts index b38543fa6c0a81fe0890e9d40f132e5ea0fa9887..5c29ae1f70095b9771722685ee45000b46087559 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(NodeKind.Invalid); - pandaGen.storeAccumulator(NodeKind.Invalid, this.asyncObj); + pandaGen.asyncFunctionEnter(node); + pandaGen.storeAccumulator(node, this.asyncObj); pandaGen.label(node, this.beginLabel); } diff --git a/ts2panda/src/pandagen.ts b/ts2panda/src/pandagen.ts index ad0237aa79263698f23565162556c0b1910d6a2d..eae6caebd1f64ba9ffa18c3a697368667cddf0aa 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.Invalid, label); + this.add(NodeKind.FirstNodeOfFunction, 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 | NodeKind) { + asyncFunctionEnter(node: ts.Node) { this.add(node, new EcmaAsyncfunctionenter()); }