Due you have fixed other issues like this and are more familiarized with this part, do you mind to take a look to this one?
I have this template
{{ function echo(message) }}
{{ message }}
{{ /function }}
{{ set foo = "It works!" }}
{{ echo(foo) }}
And it produces the following error:
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'stack')
this.scopes[this.globalScope].stack.push(val);
^
at ScopeTracker.pushBinding (file:///Users/oscarotero/www/ventojs/vento/src/transformer.ts:67:37)
at ScopeTracker.pushPatternBinding (file:///Users/oscarotero/www/ventojs/vento/src/transformer.ts:76:14)
at ScopeTracker.pushPatternBindings (file:///Users/oscarotero/www/ventojs/vento/src/transformer.ts:109:12)
at Object.enter (file:///Users/oscarotero/www/ventojs/vento/src/transformer.ts:174:19)
at SyncWalker.visit (file:///Users/oscarotero/Library/Caches/deno/npm/registry.npmjs.org/estree-walker/3.0.3/src/sync.js:65:16)
at SyncWalker.visit (file:///Users/oscarotero/Library/Caches/deno/npm/registry.npmjs.org/estree-walker/3.0.3/src/sync.js:100:19)
at Module.walk (file:///Users/oscarotero/Library/Caches/deno/npm/registry.npmjs.org/estree-walker/3.0.3/src/index.js:20:18)
at transformTemplateCode (file:///Users/oscarotero/www/ventojs/vento/src/transformer.ts:168:10)
at file:///Users/oscarotero/www/ventojs/vento/test/transform.ts:5:1
@wrapperup Hi! 👋
Due you have fixed other issues like this and are more familiarized with this part, do you mind to take a look to this one?
I have this template
And it produces the following error:
The code that is trying to transform is this one:
Seems that the problem is the
var foo = "It works!";
. Removing this line, the code is transformed correctly.I've added this test case reproducing the error: https://github.com/ventojs/vento/blob/main/test/with.test.ts#L30-L38