Creates a new closure manager.

@param {Object} parent
@param {Array} listOfKeys (names)
@param {Function} accessor
505922
function Closure (parent, listOfKeys, accessor) {
  "use strict";

  var closure = {};

  listOfKeys = listOfKeys || [];
  accessor   = accessor || function () {};
  
  parent && parent.__mixin__ && parent.__mixin__(closure);

  listOfKeys.forEach(function (key) {
    closure[key] = accessor.bind(null, key);
  });

  this.getValues = function () {
    var values = {};
    Object.keys(closure).forEach(function (key) {
      values[key] = closure[key]();
      if (values[key] === undefined) {
        values[key] = null;
      }
      if (typeof values[key] === 'function') {
        throw new Error('a closure variable must be serializable, so you cannot use a function');
      }
    });
    return values;
  }

  this.setValues = function (values) {
    Object.keys(values).forEach(function (key) {
      closure[key](values[key]);
    });
  }

  this.__mixin__ = function (object) {
    Object.keys(closure).forEach(function (key) {
      object[key] = closure[key];
    });
  }

}
386724
function CollectionIterator(keys, values, nextFn) {
    var that = this;

    this._keys   = keys;
    this._values = values;
    this["next"] = nextFn;
    this._cursor = -1;

    if (global["Symbol"]) { // ES2015 Spec
        this[global["Symbol"]["iterator"]] = function() {
            return that;
        };
    }
}
618400
function createIteratorForKey(object, k) {
  const v = object[k];

  if (v instanceof Set) {
    const iterator = v.values();

    return new Iterator(function() {
      const step = iterator.next();

      if (step.done)
        return step;

      const edgeData = step.value;

      return {
        done: false,
        value: [
          edgeData.key,
          edgeData.attributes,
          edgeData.source.key,
          edgeData.target.key,
          edgeData.source.attributes,
          edgeData.target.attributes
        ]
      };
    });
  }

  return Iterator.of([
    v.key,
    v.attributes,
    v.source.key,
    v.target.key,
    v.source.attributes,
    v.target.attributes
  ]);
}
1138166
def pkeys(self,parent,field):
    ""
    template=[(parent[k] if k is not None else None) for k in self.pkey]
    inull=template.index(None)
    def mk(x):
      "helper for constructing pkey tuples in a list comp"
      template[inull]=x
      return tuple(template)
    val=parent[field]
    if self.getter is not None: return map(mk,self.getter(val))
    elif isinstance(val,VDList): return map(mk,val.generate())
    else: raise NotImplementedError(type(val))
1049916
function(key) {
    var me = treeObject[key];
    if (me.parent > -1) {
      $(tocList[me.parent]).show();
      showParents(me.parent);
    }
  }
576352
function eClosure(eMoves,eMoveMap) {
  var closureMap={};
  eMoves.forEach(function (state) { // FK forEach pass extra args
    closure(state);
  });
  return closureMap;

  function closure(state,_chain) {
    if (closureMap.hasOwnProperty(state)) return closureMap[state];
    if (!eMoveMap.hasOwnProperty(state)) return false;
    _chain=_chain||[state];
    var dest=eMoveMap[state],
        queue=dest.to.slice(),
        toStates=[state],s,clos;
    while (queue.length) {
      s=queue.shift();
      if (~_chain.indexOf(s)) {
        throw new Error("Recursive ε-move:"+_chain.join(">")+">"+s+"!");
      }
      clos=closure(s,_chain);
      if (clos)  queue=clos.slice(1).concat(queue);
      toStates.push(s);
    }
    return closureMap[state]=toStates;
  }
}
41669
function accessEntry (context, keys) {
    _.each(keys, function (key) {
        if (context) {
            context = context[key];
        }
    });
    return context;
}
238483
function (iterator, context) {
        _.forEach(this.members, _.isFunction(iterator) ? iterator.bind(context || this.__parent) : iterator);
    }
1311530
function Scope(parent) {
        this.names = {};        // names defined in this scope
        this.mangled = {};      // mangled names (orig.name => mangled)
        this.rev_mangled = {};  // reverse lookup (mangled => orig.name)
        this.cname = -1;        // current mangled name
        this.refs = {};         // names referenced from this scope
        this.uses_with = false; // will become TRUE if eval() is detected in this or any subscopes
        this.uses_eval = false; // will become TRUE if with() is detected in this or any subscopes
        this.parent = parent;   // parent scope
        this.children = [];     // sub-scopes
        if (parent) {
                this.level = parent.level + 1;
                parent.children.push(this);
        } else {
                this.level = 0;
        }
}
1077326
function(dfd, opts, parent, pathSegList) {
			var deferredList,
				i,
				key,
				node,
				remainMap,
				tmpParent,
				segList,
				subDfd,
				self = this;

			function __findChild(parent, key) {
				// console.log("__findChild", key, parent);
				var i,
					l,
					cl = parent.children;

				if (cl) {
					for (i = 0, l = cl.length; i < l; i++) {
						if (opts.matchKey(cl[i], key)) {
							return cl[i];
						}
					}
				}
				return null;
			}

			// console.log("_loadKeyPathImpl, parent=", parent, ", pathSegList=", pathSegList);

			// Pass 1:
			// Handle all path segments for nodes that are already loaded.
			// Collect distinct top-most lazy nodes in a map.
			// Note that we can use node.key to de-dupe entries, even if a custom matcher would
			// look for other node attributes.
			// map[node.key] => {node: node, pathList: [list of remaining rest-paths]}
			remainMap = {};

			for (i = 0; i < pathSegList.length; i++) {
				segList = pathSegList[i];
				// target = targetList[i];

				// Traverse and pop path segments (i.e. keys), until we hit a lazy, unloaded node
				tmpParent = parent;
				while (segList.length) {
					key = segList.shift();
					node = __findChild(tmpParent, key);
					if (!node) {
						this.warn(
							"loadKeyPath: key not found: " +
								key +
								" (parent: " +
								tmpParent +
								")"
						);
						opts.callback(this, key, "error");
						break;
					} else if (segList.length === 0) {
						opts.callback(this, node, "ok");
						break;
					} else if (!node.lazy || node.hasChildren() !== undefined) {
						opts.callback(this, node, "loaded");
						tmpParent = node;
					} else {
						opts.callback(this, node, "loaded");
						key = node.key; //target.segList.join(sep);
						if (remainMap[key]) {
							remainMap[key].pathSegList.push(segList);
						} else {
							remainMap[key] = {
								parent: node,
								pathSegList: [segList],
							};
						}
						break;
					}
				}
			}
			// console.log("_loadKeyPathImpl AFTER pass 1, remainMap=", remainMap);

			// Now load all lazy nodes and continue iteration for remaining paths
			deferredList = [];

			// Avoid jshint warning 'Don't make functions within a loop.':
			function __lazyload(dfd, parent, pathSegList) {
				// console.log("__lazyload", parent, "pathSegList=", pathSegList);
				opts.callback(self, parent, "loading");
				parent
					.load()
					.done(function() {
						self._loadKeyPathImpl
							.call(self, dfd, opts, parent, pathSegList)
							.always(_makeResolveFunc(dfd, self));
					})
					.fail(function(errMsg) {
						self.warn("loadKeyPath: error loading lazy " + parent);
						opts.callback(self, node, "error");
						dfd.rejectWith(self);
					});
			}
			// remainMap contains parent nodes, each with a list of relative sub-paths.
			// We start loading all of them now, and pass the the list to each loader.
			for (var nodeKey in remainMap) {
				var remain = remainMap[nodeKey];
				// console.log("for(): remain=", remain, "remainMap=", remainMap);
				// key = remain.segList.shift();
				// node = __findChild(remain.parent, key);
				// if (node == null) {  // #576
				// 	// Issue #576, refactored for v2.27:
				// 	// The root cause was, that sometimes the wrong parent was used here
				// 	// to find the next segment.
				// 	// Falling back to getNodeByKey() was a hack that no longer works if a custom
				// 	// matcher is used, because we cannot assume that a single segment-key is unique
				// 	// throughout the tree.
				// 	self.error("loadKeyPath: error loading child by key '" + key + "' (parent: " + target.parent + ")", target);
				// 	// 	node = self.getNodeByKey(key);
				// 	continue;
				// }
				subDfd = new $.Deferred();
				deferredList.push(subDfd);
				__lazyload(subDfd, remain.parent, remain.pathSegList);
			}
			// Return a promise that is resolved, when ALL paths were loaded
			return $.when.apply($, deferredList).promise();
		}
1281475
function(parent) {
            var clazzParent = this;

            while (clazzParent) {
                if (clazzParent === parent || clazzParent.__name === parent) {
                    return true;
                }
                clazzParent = clazzParent.__parent;
            }

            return false;
        }
886090
function (key, value) {
        var accessor = getAccessors(this)[key],
            oldVal = this.get(key);


        this.triggerBeforeChanged(key, oldVal);

        if (accessor) {
            accessor.target.set(accessor.key, value);
        } else {

            if (this['set_' + key]) {
                this['set_' + key](value);
            } else {
                this[key] = value;
            }
        }
        this.triggerChanged(key, oldVal);
    }
127718
function(keys, timeout) {
  this.isDone = false;
  this.keys = keys;
  this.expected = keys.length;
  this.count = 0;
  this.timeout = timeout;
  this.data = {};
  this.errs = [];
  this.events = {
    error: null,
    timeout: null,
    done: null,
  };
  const collector = this;
  if (this.timeout) {
    this.timer = setTimeout(() => {
      const err = new Error(COLLECT_TIMEOUT);
      collector.emit('timeout', err, collector.data);
    }, timeout);
  }
}
476253
function checkNoSameAddressInDifferentParents(){
		if (objUnit.parent_units.length === 1)
			return callback();
		var assocAuthors = {};
		var found_address;
		async.eachSeries(
			objUnit.parent_units,
			function(parent_unit, cb){
				storage.readUnitAuthors(conn, parent_unit, function(arrAuthors){
					arrAuthors.forEach(function(address){
						if (assocAuthors[address])
							found_address = address;
						assocAuthors[address] = true;
					});
					cb(found_address);
				});
			},
			function(){
				if (found_address)
					return callback("some addresses found more than once in parents, e.g. "+found_address);
				return callback();
			}
		);
	}
1246932
function parents (pipe, taskKey) {
  var inputPipesOf = inputPipes.bind(null, pipe)
  var parentTaskIds = []

  function pushParentTaskId (pipe) {
    parentTaskIds.push(pipe[0])
  }

  inputPipesOf(taskKey).forEach(pushParentTaskId)

  return parentTaskIds
}
1038195
function keysIndexes(children, startIndex, endIndex) {
  var i, keys = Object.create(null), key;
  for (i = startIndex; i <= endIndex; ++i) {
    if (children[i]) {
      key = children[i].key;
      if (key !== undefined) {
        keys[key] = i;
      }
    }
  }
  return keys;
}
689584
function(type){
    return function(prop){
        var accessor = this.getAccessor(prop, type),
            accessorName = this._accessorName;

        /**
         * Prevent recursive get calls by checking if it's currently accessing
         * and if the accessor name is the same as the property arg. If all positive,
         * then return the value from _data/_previousData, otherwise return from 
         * the accessor function. Fallback to returning from the _data/_previousData
         * if an accessor function does not exist.
         */
        if (accessor && accessorName != prop) {
            return accessor();
        }

        return this.parent(prop);
    }.overloadGetter();
}