enhance collapse_vars (#5186)

closes #5182
This commit is contained in:
Alex Lam S.L
2021-11-24 09:28:36 +00:00
committed by GitHub
parent dc9e1ff0b1
commit 1a8f2ecc65
3 changed files with 101 additions and 10 deletions

View File

@@ -1999,7 +1999,7 @@ TreeWalker.prototype = {
},
find_parent: function(type) {
var stack = this.stack;
for (var i = stack.length; --i >= 0;) {
for (var i = stack.length - 1; --i >= 0;) {
var x = stack[i];
if (x instanceof type) return x;
}