open2b/scriggo

Runtime panic in template related to defer (needs investigation)

Opened this issue · 1 comments

How to reproduce

Add this test to test/misc/templates_test.go:

"https://github.com/open2b/scriggo/issues/936": {
	sources: fstest.Files{
		"index.txt": `
			{% var f = func() []int {
				defer func() { }()
				return []int{}
			} %}
	
			{% for v in f() %}
			{% end for %}
	
			Some text`,
	},
},

Note that this issue can be reduced to this:

"https://github.com/open2b/scriggo/issues/936": {
	sources: fstest.Files{
		"index.txt": `{%%
			var f = func() {
				defer func() { }()
				return
			}
			f()
		%%}some text`,
	},
},