We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 51cb83d commit 44bdc9bCopy full SHA for 44bdc9b
soyhtml/exec.go
@@ -144,10 +144,15 @@ func (s *state) walk(node ast.Node) {
144
break
145
}
146
s.context.push()
147
+ var (
148
+ keyVar = node.Var
149
+ keyInd = node.Var + "__index"
150
+ keyLast = node.Var + "__lastIndex"
151
+ )
152
+ s.context.set(keyLast, data.Int(len(list)-1))
153
for i, item := range list {
- s.context.set(node.Var, item)
- s.context.set(node.Var+"__index", data.Int(i))
- s.context.set(node.Var+"__lastIndex", data.Int(len(list)-1))
154
+ s.context.set(keyVar, item)
155
+ s.context.set(keyInd, data.Int(i))
156
s.walk(node.Body)
157
158
s.context.pop()
0 commit comments