code: function fixrefs(scope, i) {
                          // do children first; order shouldn't matter
                          for (i = scope.children.length; --i >= 0;)
                                  fixrefs(scope.children[i]);
                          for (i in scope.refs) if (HOP(scope.refs, i)) {
                                  // find origin scope and propagate the reference to origin
                                  for (var origin = scope.has(i), s = scope; s; s = s.parent) {
                                          s.refs[i] = origin;
                                          if (s === origin) break;
                                  }
                          }
                  }
docs: for referenced names it might be useful to know their origin scope.  current_scope here is the toplevel one.