Work around a Closure Compiler bug without a pre/post process. [via @phated]

Former-commit-id: 2b9ead74c8c29357a7d8af965b6e0702e77872a5
This commit is contained in:
John-David Dalton
2012-11-08 09:01:47 -08:00
parent a1545c60d6
commit d255f8400f
5 changed files with 58 additions and 67 deletions

View File

@@ -18,13 +18,14 @@
/** Used for array and object method references */
var arrayRef = [],
objectRef = {};
// avoid a Closure Compiler bug by creatively creating an object
objectRef = new function(){};
/** Used to generate unique IDs */
var idCounter = 0;
/** Used internally to indicate various things */
var indicatorObject = {};
var indicatorObject = objectRef;
/** Used by `cachedContains` as the default size when optimizations are enabled for large arrays */
var largeArraySize = 30;
@@ -1629,7 +1630,7 @@
stackA = args[3],
stackB = args[4];
if (indicator !== indicatorObject) {
if (indicator !== objectRef) {
stackA = [];
stackB = [];
length = args.length;
@@ -1657,7 +1658,7 @@
: (isPlainObject(value) ? value : {})
);
// recursively merge objects and arrays (susceptible to call stack limits)
object[key] = merge(value, source, indicatorObject, stackA, stackB);
object[key] = merge(value, source, objectRef, stackA, stackB);
}
} else if (source != null) {
object[key] = source;