/*  Use $alias to make member aliases with correct semantics
========================================================================
517559
function () {

        var foo = new ($prototype ({

            error: function () { return 'foo.error' },

            failure:              $alias ('error'),
            crash:                $alias ('error'),
            finalCrash:   $final ($alias ('crash')) /* chaining works */        })) ()
                
                var def = foo.constructor.$definition

                $assert (foo.finalCrash, foo.crash, foo.failure, foo.error) // all point to same function

                $assert    ($final.is (def.finalCrash))   // you can add new tags to alias members
                $assertNot ($final.is (def.crash))        // adding tags to alias members does not affect original members 
                $assertNot ($final.is (def.error))

        /*  Ad-hoc property aliases (applicable even when there's no explicitly declared member at what alias points to)
         */
        var size = new ($prototype ({
            w:  $alias ($property ('x')),
            h:  $alias ($property ('y')) })) ()

                $assert ([size.x = 42, size.y = 24], [size.w, size.h], [42, 24]) }
105020
function () {
      var doUniqueMemberIdsCheck = function (compound) {
        var duplicateMemberIds = [];
        compound.members.forEach(function (member) {
          var memberId = member.memberId;

          function filterByMemberId (member) {
            return member.memberId === memberId;
          }

          var arrayByMemberId = compound.members.filter(filterByMemberId);
          if (arrayByMemberId.length > 1 && duplicateMemberIds.indexOf(memberId) < 0) {
            duplicateMemberIds.push(memberId);
          }
        });
        duplicateMemberIds.forEach(function (memberId) {
          errors.push('RuleViolation identified: Artifact \'' + compound.artifactId +
            '\' contains multiple members with \'memberId\'=\'' + memberId + '\'');
        });
      };
      //
      if (doc.artifacts && doc.artifacts.compoundComponents) {
        doc.artifacts.compoundComponents.forEach(doUniqueMemberIdsCheck);
      }
    }
711790
private boolean tryReplacingAliasingAssignment(Ref alias, Node aliasLhsNode) {
    // either VAR/CONST/LET or ASSIGN.
    Node assignment = aliasLhsNode.getParent();
    if (!NodeUtil.isNameDeclaration(assignment) && NodeUtil.isExpressionResultUsed(assignment)) {
      // e.g. don't change "if (alias = someVariable)" to "if (alias = null)"
      // TODO(lharker): instead replace the entire assignment with the RHS - "alias = x" becomes "x"
      return false;
    }
    Node aliasParent = alias.getNode().getParent();
    aliasParent.replaceChild(alias.getNode(), IR.nullNode());
    alias.name.removeRef(alias);
    codeChanged = true;
    compiler.reportChangeToEnclosingScope(aliasParent);
    return true;
  }
692962
function setLocalNamespace (alias, postfix) {
    // require valid alias
    assert.ok(typeof alias === 'string' && alias.length > 1, 'valid namespace alias required')
    // do not allow the alias session to be used
    assert.ok(!reservedNamespaces[alias], `namespace alias ${alias} is reserved`)
    // require valid postfix
    assert.ok(typeof postfix === 'string' && postfix.length > 1, 'valid namespace postfix required')
    // set namespace
    GLOBAL.localNamespaces[alias] = postfix
    // return class
    return ImmutableAI
}
240504
function (newPrototype) {
        _gpfObjectForEach(this._initialDefinition, function (value, memberName) {
            if (!memberName.startsWith("$")) {
                newPrototype[memberName] = value;
            }
        }, this);
    }
1279361
function alias($name,$params=NULL,$lang=NULL) {
		if (in_array($name,$this->global_aliases))
			return $this->f3->alias($name,$params);
		if (!is_array($params))
			$params=$this->f3->parse($params);
		if (!$lang)
			$lang=$this->current;
		if (isset($this->rules[$lang][$name]) && $this->rules[$lang][$name]===FALSE)
			return FALSE;
		$url=isset($this->rules[$lang][$name])?
			$this->rules[$lang][$name]:@$this->_aliases[$name];
		if (!$url)
			user_error(sprintf(\Base::E_Named,$name),E_USER_ERROR);
		return $this->f3->build(rtrim('/'.$lang.$url,'/'),$params);
	}
634380
function(ns, members) {
			var no;
			if (gui.Type.isString(ns)) {
				no = gui.Object.lookup(ns);
				no = new gui.Namespace(ns);
				no = gui.Object.assert(ns, no);
			} else {
				throw new TypeError("Expected a namespace string");
			}
			return gui.Object.extend(no, members || {});
		}
487812
function (runtime, names) {
            var ret = [].concat(names),
                i,
                m,
                alias,
                ok = 0,
                j,
                mods = runtime['Env'].mods;
            while (!ok) {
                ok = 1;
                for (i = ret.length - 1; i >= 0; i--) {
                    if ((m = mods[ret[i]]) && (alias = m.alias)) {
                        ok = 0;
                        for (j = alias.length - 1; j >= 0; j--) {
                            if (!alias[j]) {
                                alias.splice(j, 1);
                            }
                        }
                        ret.splice.apply(ret, [i, 1].concat(indexMap(alias)));
                    }
                }
            }
            return ret;
        }
1159627
function getAliases(actionObj, defaultVerb, defaultPath, hasAlias) {
    if (hasAlias === false) return [];
    if (actionObj.aliases.length !== 0) {
      return actionObj.aliases; // some custom aliases.
    }
    var rootPath = actionObj.rootPath;
    if (rootPath.charAt(0) !== '/') rootPath = '/' + rootPath;
    if (rootPath.charAt(rootPath.length - 1) === '/') rootPath = rootPath.substr(0, rootPath.length - 1);
    rootPath += defaultPath;
    return [[defaultVerb, rootPath]];
  }
595526
function(){
    var sourceMap = this.sourceMap_;
    var memberMap = this.members_;
    var curMember;
    var newMember;
    var curMemberId;
    var newMemberId;
    var sourceObject;
    var sourceObjectInfo;
    var inserted = [];
    var deleted = [];
    var delta;

    for (var sourceObjectId in sourceMap)
    {
      sourceObjectInfo = sourceMap[sourceObjectId];
      sourceObject = sourceObjectInfo.sourceObject;

      curMember = sourceObjectInfo.member;
      newMember = this.map ? this.map(sourceObject) : sourceObject;

      if (newMember instanceof DataObject == false || this.filter(newMember))
        newMember = null;

      if (!isEqual(curMember, newMember))
      {
        sourceObjectInfo.member = newMember;

        // if here is ref for member already
        if (curMember)
        {
          curMemberId = curMember.basisObjectId;

          // call callback on member ref add
          if (this.removeMemberRef)
            this.removeMemberRef(curMember, sourceObject);

          // decrease ref count
          memberMap[curMemberId]--;
        }

        // if new member exists, update map
        if (newMember)
        {
          newMemberId = newMember.basisObjectId;

          // call callback on member ref add
          if (this.addMemberRef)
            this.addMemberRef(newMember, sourceObject);

          if (newMemberId in memberMap)
          {
            // member is already in map -> increase ref count
            memberMap[newMemberId]++;
          }
          else
          {
            // add to map
            memberMap[newMemberId] = 1;

            // add to delta
            inserted.push(newMember);
          }
        }
      }
    }

    // get deleted delta
    for (curMemberId in this.items_)
      if (memberMap[curMemberId] == 0)
      {
        delete memberMap[curMemberId];
        deleted.push(this.items_[curMemberId]);
      }

    // if any changes, fire event
    if (delta = getDelta(inserted, deleted))
      this.emit_itemsChanged(delta);

    return delta;
  }
147721
function put_member_object(MemberName, Member) {
	// Get the Member Object filename.
	var filename = get_member_path(MemberName);
	npm_fs_extra.ensureDirSync(filename);
	// Write the Member Object.
	filename = npm_path.join(filename, 'member.json');
	npm_fs_extra.outputFileSync(filename, JSON.stringify(Member, null, 4));
	return;
}
184087
function getAliases(index) {
  if (this._aliases === undefined) {
    var owner = this;
    this._aliases = _(getValue(this, 'alias'))
      .split(/,\s*/)
      .compact()
      .sort(util.compareNatural)
      .map(function(value) { return new Alias(value, owner); })
      .value();
  }
  var result = this._aliases;
  return index === undefined ? result : result[index];
}
551452
function injectMissingPrefix() {
        const injector = p => {
            const { property } = p.parentPath.value;
            if (property && property.type === j.Identifier.name) {
                if (property.name !== 'to') {
                    const newPath = j.memberExpression(p.value, j.identifier('to'));
                    p.replace(newPath);
                }
            }
        };

        root
            .find(j.CallExpression, {
                callee: {
                    name: name => ['expect', 'should'].indexOf(name) >= 0,
                },
            })
            .forEach(injector);

        root
            .find(j.MemberExpression, {
                property: {
                    type: j.Identifier.name,
                    name: 'should',
                },
            })
            .forEach(injector);
    }
1151767
function beforeParse(e)
    {
        var namespace = e.source.match(rgxNamespace);
        var className = e.source.match(rgxClassName);

        // Fix members not showing up attached to class
        if (namespace && className)
        {
            // console.log(`${namespace[1]}.${className[2]}`);
            // Replaces "@member {Type}"" with "@member {Type} PIXI.ClassName#prop"
            e.source = e.source.replace(rgxMember, '$1 '+ namespace[1] + '.' + className[2] + '#$4$2$3');
        }

        e.source = e.source.replace(rgxGross, grossReplace);
    }
307832
function commandAlias(context, name) {
    let value;
    context.alias = context.alias || {};

    value = context.last;

    name = context.valueOf(name, true);
    value = context.valueOf(value, true);

    if (context.debug) {
        log.debug('cmd alias ' + stringify(name) + ' ' + stringify(value));
    }
    context.alias[name] = value;

    return (context.last = [VALUE, value]);
}
885055
function Reference(ident, scope, flag,writeExpr, maybeImplicitGlobal, partial, init) {
      /**
       * Identifier syntax node.
       * @member {esprima#Identifier} Reference#identifier
       */
      this.identifier = ident;
      /**
       * Reference to the enclosing Scope.
       * @member {Scope} Reference#from
       */
      this.from = scope;
      /**
       * Whether the reference comes from a dynamic scope (such as 'eval',
       * 'with', etc.), and may be trapped by dynamic scopes.
       * @member {boolean} Reference#tainted
       */
      this.tainted = false;
      /**
       * The variable this reference is resolved with.
       * @member {Variable} Reference#resolved
       */
      this.resolved = null;
      /**
       * The read-write mode of the reference. (Value is one of {@link
       * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}).
       * @member {number} Reference#flag
       * @private
       */
      this.flag = flag;
      if (this.isWrite()) {
          /**
           * If reference is writeable, this is the tree being written to it.
           * @member {esprima#Node} Reference#writeExpr
           */
          this.writeExpr = writeExpr;
          /**
           * Whether the Reference might refer to a partial value of writeExpr.
           * @member {boolean} Reference#partial
           */
          this.partial = partial;
          /**
           * Whether the Reference is to write of initialization.
           * @member {boolean} Reference#init
           */
          this.init = init;
      }
      this.__maybeImplicitGlobal = maybeImplicitGlobal;
  }
628037
function symbolAlias(aliasFor) {
  return function(lexer, text) {
    var token = lexer.next_token(text);
    return sl.atom(aliasFor, {token: token});
  }
}