vendor/lib/visitor/evaluator.js in stylus-source-0.19.0 vs vendor/lib/visitor/evaluator.js in stylus-source-0.19.1

- old
+ new

@@ -877,11 +877,13 @@ * @api private */ Evaluator.prototype.lookupProperty = function(name){ var i = this.stack.length - , curr = this.property && this.property.name + , prop = this.property + , curr = prop && prop.name + , index = this.currentBlock.index , top = i , nodes , block , other; @@ -890,15 +892,21 @@ if (!block.node) continue; switch (block.node.nodeName) { case 'group': case 'function': nodes = block.nodes; - for (var j = 0, len = nodes.length; j < len; ++j) { - if ('property' != nodes[j].nodeName) continue; - other = this.interpolate(nodes[j]); - if (curr == other && i + 1 == top) continue; - if (name == other) { - return nodes[j].clone(); + // scan siblings from the property index up + if (i + 1 == top) { + while (index--) { + other = this.interpolate(nodes[index]); + if (name == other) return nodes[index].clone(); + } + // sequential lookup for non-siblings (for now) + } else { + for (var j = 0, len = nodes.length; j < len; ++j) { + if ('property' != nodes[j].nodeName) continue; + other = this.interpolate(nodes[j]); + if (name == other) return nodes[j].clone(); } } break; } }