code: function const_lookup_nesting(nesting, name) {
      var i, ii, result, constant;
  
      if (nesting.length === 0) return;
  
      // If the nesting is not empty the constant is looked up in its elements
      // and in order. The ancestors of those elements are ignored.
      for (i = 0, ii = nesting.length; i < ii; i++) {
        constant = nesting[i].$$const[name];
        if (constant != null) return constant;
      }
    }
docs: Walk up the nesting array looking for the constant