Move a property defined by assignment to `.prototype` or `.prototype.propName`.

<pre><code>
Foo.prototype.propName = function() {};
</code></pre>
494312
private void movePrototypeDotMethodAssignment(Node destParent, Node functionNode) {
    checkState(functionNode.isFunction(), functionNode);
    Node assignNode = functionNode.getParent();
    checkState(assignNode.isAssign() && functionNode.isSecondChildOf(assignNode), assignNode);
    Node definitionStatement = assignNode.getParent();
    checkState(definitionStatement.isExprResult(), assignNode);

    if (noStubFunctions) {
      // Remove the definition statement from its current location
      Node assignStatementParent = definitionStatement.getParent();
      definitionStatement.detach();
      compiler.reportChangeToEnclosingScope(assignStatementParent);

      // Prepend definition to new chunk
      // Foo.prototype.propName = function() {};
      destParent.addChildToFront(definitionStatement);
      compiler.reportChangeToEnclosingScope(destParent);
    } else {
      int stubId = idGenerator.newId();

      // replace function definition with temporary placeholder so we can clone the whole
      // assignment statement without cloning the function definition itself.
      Node originalDefinitionPlaceholder = astFactory.createEmpty();
      functionNode.replaceWith(originalDefinitionPlaceholder);
      Node newDefinitionStatement = definitionStatement.cloneTree();
      Node newDefinitionPlaceholder =
          newDefinitionStatement // EXPR_RESULT
              .getOnlyChild() // ASSIGN
              .getLastChild(); // EMPTY RHS node

      // convert original assignment statement to
      // owner.prototype.propName = JSCompiler_stubMethod(0);
      Node stubCall = createStubCall(functionNode, stubId);
      originalDefinitionPlaceholder.replaceWith(stubCall);
      compiler.reportChangeToEnclosingScope(definitionStatement);

      // Prepend new definition to new chunk
      // Foo.prototype.propName = JSCompiler_unstubMethod(0, function() {});
      Node unstubCall = createUnstubCall(functionNode, stubId);
      newDefinitionPlaceholder.replaceWith(unstubCall);
      destParent.addChildToFront(newDefinitionStatement);
      compiler.reportChangeToEnclosingScope(destParent);
    }
  }
616811
void renameProperties() {
    int propsRenamed = 0;
    int propsSkipped = 0;
    int instancesRenamed = 0;
    int instancesSkipped = 0;
    int singleTypeProps = 0;

    Set<String> reported = new HashSet<>();
    for (Property prop : properties.values()) {
      if (prop.shouldRename()) {
        UnionFind<JSType> pTypes = prop.getTypes();
        Map<JSType, String> propNames = buildPropNames(prop);

        ++propsRenamed;
        prop.expandTypesToSkip();
        // This loop has poor locality, because instead of walking the AST,
        // we iterate over all accesses of a property, which can be in very
        // different places in the code.
        for (Map.Entry<Node, JSType> entry : prop.rootTypesByNode.entrySet()) {
          Node node = entry.getKey();
          JSType rootType = entry.getValue();
          if (prop.shouldRename(rootType)) {
            String newName = propNames.get(pTypes.find(rootType));
            node.setString(newName);
            compiler.reportChangeToEnclosingScope(node);
            ++instancesRenamed;
          } else {
            ++instancesSkipped;

            CheckLevel checkLevelForProp = propertiesToErrorFor.get(prop.name);
            if (checkLevelForProp != null
                && checkLevelForProp != CheckLevel.OFF
                && !reported.contains(prop.name)) {
              reported.add(prop.name);
              compiler.report(JSError.make(
                  node,
                  checkLevelForProp,
                  Warnings.INVALIDATION_ON_TYPE, prop.name,
                  rootType.toString(), ""));
            }
          }
        }
      } else {
        if (prop.skipRenaming) {
          ++propsSkipped;
        } else {
          ++singleTypeProps;
        }
      }
    }
    if (logger.isLoggable(Level.FINE)) {
      logger.fine("Renamed " + instancesRenamed + " instances of "
                  + propsRenamed + " properties.");
      logger.fine("Skipped renaming " + instancesSkipped + " invalidated "
                  + "properties, " + propsSkipped + " instances of properties "
                  + "that were skipped for specific types and " + singleTypeProps
                  + " properties that were referenced from only one type.");
    }
  }
1135755
function addMetaProperty (object, propName, value) {
  defineProperty(object, propName, {
    enumerable: false,
    value
  })
}
167176
function(properties, superPrototype) {
		// Use this instance's prototype if no prototype provided
		superPrototype = superPrototype || this.constructor && this.constructor.prototype;
		
		// Copy the properties onto the new prototype
		for (var name in properties) {
			var value = properties[name];

			// Never mix construct or destruct
			if (name === 'construct' || name === 'destruct')
				continue;

			// Check if the property if a method that makes use of _super:
			// 1. The value should be a function
			// 2. The super prototype should have a function by the same name
			// 3. The function should use this._super somewhere
			var usesSuper = superPrototype && typeof value === 'function' && typeof superPrototype[name] === 'function' && superTest.test(value);

			if (usesSuper) {
				// Wrap the function such that this._super will be available
				if (this.hasOwnProperty(name)) {
					// Properties that exist directly on the object should be superified statically
					this[name] = superifyStatic(name, value, this);
				}
				else {
					// Properties that are part of the superPrototype should be superified dynamically
					this[name] = superifyDynamic(name, value, superPrototype);
				}
			}
			else {
				// Directly assign the property
				this[name] = value;
			}
		}
	}
1014579
private void moveMethods(Collection<NameInfo> allNameInfo) {
    boolean hasStubDeclaration = idGenerator.hasGeneratedAnyIds();
    for (NameInfo nameInfo : allNameInfo) {
      if (!nameInfo.isReferenced()) {
        // The code below can't do anything with unreferenced name
        // infos.  They should be skipped to avoid NPE since their
        // deepestCommonModuleRef is null.
        continue;
      }

      if (nameInfo.readsClosureVariables()) {
        continue;
      }

      JSModule deepestCommonModuleRef = nameInfo.getDeepestCommonModuleRef();
      if (deepestCommonModuleRef == null) {
        compiler.report(JSError.make(NULL_COMMON_MODULE_ERROR));
        continue;
      }

      Iterator<Symbol> declarations =
          nameInfo.getDeclarations().descendingIterator();
      while (declarations.hasNext()) {
        Symbol symbol = declarations.next();
        if (symbol instanceof PrototypeProperty) {
          tryToMovePrototypeMethod(nameInfo, deepestCommonModuleRef, (PrototypeProperty) symbol);
        } else if (symbol instanceof ClassMemberFunction) {
          tryToMoveMemberFunction(nameInfo, deepestCommonModuleRef, (ClassMemberFunction) symbol);
        } // else it's a variable definition, and we don't move those.
      }
    }

    if (!noStubFunctions && !hasStubDeclaration && idGenerator
        .hasGeneratedAnyIds()) {
      // Declare stub functions in the top-most chunk.
      Node declarations = compiler.parseSyntheticCode(STUB_DECLARATIONS);
      NodeUtil.markNewScopesChanged(declarations, compiler);
      Node firstScript = compiler.getNodeForCodeInsertion(null);
      firstScript.addChildrenToFront(declarations.removeChildren());
      compiler.reportChangeToEnclosingScope(firstScript);
    }
  }
359112
function propReplace(obj, prop, value) {
    var o = {};
    for (var p in obj) {
        if (o.hasOwnProperty.call(obj, p)) {
            if (typeof obj[p] == 'object' && !Array.isArray(obj[p])) {
                propReplace(obj[p], prop, value);
            } else if (p == prop) {
                obj[p] = value;
            }
        }
    }
}
1364026
function setDeepProperty (obj, propName, propValue) {
  propName = propName.split(".");
  for (let i = 0; i < propName.length - 1; i++) {
    obj = obj[propName[i]] = obj[propName[i]] || {};
  }
  obj[propName[propName.length - 1]] = propValue;
}
1274340
function custom (properties, property, key, event) {
  if (property === null) {
    properties[key] = null
  } else if (property.val) {
    property.val = parseProperty(property.val)
    var prototype = property.val.prototype
    if (prototype && prototype instanceof Base) {
      if (property.override) {
        properties._overrides = properties._overrides || {}
        properties._overrides[key] = property.override
        properties[key] = Properties
          .createPropertyConstructor(property.val, property.override, true)
        properties[key].override = property.override
        properties[property.override] = properties[key]
      } else {
        this[key] = properties[key] = prototype
        prototype._parent = this
      }
    } else {
      if (property.override) {
        properties[key] = Properties.createPrimitiveProperty(property.override)
      } else {
        properties[key] = Properties.default
      }
      properties[key].call(this, property.val, void 0, void 0, key)
    }
  } else if (key !== '_overrides') {
    if (property.type) {
      let res = this.getType(property, event, key, void 0)
      if (res instanceof Base) {
        properties[key] = Properties
        .createPropertyConstructor(new res.Constructor(property, false, this, key).Constructor, key)
        return
      }
    }
    properties[key] = Properties
      .createPropertyConstructor(new this.Child(property, false, this, key).Constructor, key)
  }
}
215628
function (prop) {
      var keys = Object.keys(this.keyMap);
      var items = this.items.map(function (item, i) {
        item.key = keys[i];
        return item;
      });
      var sorted = lazy.arraySort(items, prop);
      this.items = sorted;
      this.keyMap = this.items.reduce(function (acc, item, i) {
        acc[item.key] = i;
        return acc;
      }, {});
      return this;
    }
1209601
function Class(prop, superClass) {
        var ClassType = function() {
            function F(args) {
                for (var name in ClassType.__prop) {
                    var val = ClassType.__prop[name];
                    this[name] = isObject(val) ? extend({}, val) : val;
                }

                if (isFunction(this.__construct)) {
                    this.__construct.apply(this, [].slice.call(args));
                }

                return this;
            }

            F.prototype = ClassType.prototype;
            F.constructor = ClassType;
            return new F(arguments);
        };

        ClassType.extend = function(prop) {
            if (isFunction(prop)) {
                prop = prop();
            }

            if (isObject(prop)) {
                for (var name in prop) {
                    var val = prop[name];

                    if (name === 'parent') {
                        throw new Error("'parent' method must not be override wrote.");
                    }

                    if (isFunction(val)) {
                        ClassType.prototype[name] = val;
                    } else {
                        ClassType.__prop[name] = isObject(val) ? extend({}, val) : val;
                    }
                }
            }

            return this;
        };

        ClassType.inherits = function(superClass) {
            inherits(ClassType, superClass);
            extend(ClassType.__prop, superClass.__prop);

            return this;
        };

        ClassType.prototype.parent = function(methodName, args) {
            var super_ = this.constructor.super_;
            if (!isFunction(this[methodName]) || !isFunction(super_.prototype[methodName])) {
                throw new Error("parent has not method '" + methodName + "'.");
            }

            if (arguments.length === 1) {
                args = [];
            } else if (!isArray(args)) {
                args = [].slice.call(arguments, 1);
            }

            while ((this[methodName] === super_.prototype[methodName]) && super_.super_) {
                super_ = super_.super_;
            }

            var method = super_.prototype[methodName];
            delete super_.prototype[methodName];
            var retResult = method.apply(this, args);
            super_.prototype[methodName] = method;

            return retResult;
        };

        ClassType.__prop = {};
        if (superClass === true && isFunction(prop)) {
            superClass = prop;
            prop = undefined;
        }

        if (isFunction(superClass)) {
            ClassType.inherits(superClass);
        }

        if (prop) {
            ClassType.extend(prop);
        }

        return ClassType;
    }
1318477
function (prototype, properties) {
        var object = Object.create(prototype);
        Object.keys(properties).forEach(function (key) {
            object[key] = properties[key];
        });
        return object;
    }
100419
function baseAssignValue(object, key, value) {
  if (key == '__proto__' && defineProperty$1) {
    defineProperty$1(object, key, {
      'configurable': true,
      'enumerable': true,
      'value': value,
      'writable': true
    });
  } else {
    object[key] = value;
  }
}
801313
function(){
           var obj = arguments[0];
           var args = Array.prototype.splice.call(arguments,1,arguments.length);

           this.forEach(args,function(o,i,b){
            if(o  !== undefined && typeof o === "object"){
             for(var prop in o){
               var g = o.__lookupGetter__(prop), s = o.__lookupSetter__(prop);
               if(g || s){ this.createProperty(obj,prop,{get:g, set:s}); }
               else obj[prop]=o[prop];
            }
          }
        },this);

    }
282520
function (prop, fn) {
    if (typeof prop === 'function') {
      fn = prop;
      prop = undefined;
    }

    var items = this.items;
    this.items = lazy.sortObj(items, {
      prop: prop,
      get: fn
    });
    return this;
  }
1039562
function _props (opts, source, target) {
  let idx = opts.visited.indexOf(source) // check for circularities
  if (idx === -1) {
    opts.visited.push(source)
    opts.cloned.push(target)
    Object.getOwnPropertyNames(source).forEach(function (key) {
      if (key === 'prototype') {
        target[key] = Object.create(source[key])
        Object.getOwnPropertyNames(source[key]).forEach(function (p) {
          if (p !== 'constructor') {
            _descriptor(opts, source[key], target[key], p)
            // } else {
            //   target[key][p] = target
            //   Safari may throw here with TypeError: Attempted to assign to readonly property.
          }
        })
      } else {
        _descriptor(opts, source, target, key)
      }
    })
    opts.visited.pop()
    opts.cloned.pop()
  } else {
    target = opts.cloned[idx] // add reference of circularity
  }
  return target
}
62630
function baseAssignValue(object, key, value) {
  if (key == '__proto__' && _defineProperty$1) {
    _defineProperty$1(object, key, {
      'configurable': true,
      'enumerable': true,
      'value': value,
      'writable': true
    });
  } else {
    object[key] = value;
  }
}
490451
function movePropDefsToProto(proto) {
    var stype = proto.entityType || proto.complexType;
    var extra = stype._extra;

    var alreadyWrapped = extra.alreadyWrappedProps || {};

    stype.getProperties().forEach(function (prop) {
      var propName = prop.name;
      // we only want to wrap props that haven't already been wrapped
      if (alreadyWrapped[propName]) return;

      // If property is already defined on the prototype then wrap it in another propertyDescriptor.
      // otherwise create a propDescriptor for it.
      var descr;
      if (propName in proto) {
        descr = wrapPropDescription(proto, prop);
      } else {
        descr = makePropDescription(proto, prop);
      }
      // descr will be null for a wrapped descr that is not configurable
      if (descr != null) {
        Object.defineProperty(proto, propName, descr);
      }
      alreadyWrapped[propName] = true;
    });
    extra.alreadyWrappedProps = alreadyWrapped;
  }