Correct support.nonEnumArgs.

Former-commit-id: 69b09827404bae997846daa681d96d8c9264af78
This commit is contained in:
John-David Dalton
2013-03-08 08:56:30 -08:00
parent e84671ce5d
commit 7b35bb8c96
2 changed files with 4 additions and 3 deletions

View File

@@ -2670,11 +2670,11 @@
}
if (!/support\.(?:enumPrototypes|nonEnumShadows|ownLast)\b/.test(source)) {
// remove code used to resolve unneeded `support` properties
source = source.replace(/^ *\(function[\s\S]+?\n(( *)var ctor *= *function[\s\S]+?\n *for.+\n)([\s\S]+?)}\(1\)\);\n/m, function(match, setup, indent, body) {
source = source.replace(/^ *\(function[\s\S]+?\n(( *)var ctor *= *function[\s\S]+?(?:\n *for.+)+\n)([\s\S]+?)}\(1\)\);\n/m, function(match, setup, indent, body) {
if (/support\.spliceObjects\b/.test(match)) {
return match.replace(setup, indent + "var object = { '0': 1, 'length': 1 };\n");
} else if (/support\.nonEnumArgs\b/.test(match)) {
return match.replace(setup, '');
return match.replace(setup, indent + 'for (var prop in arguments) { }\n');
}
return body.replace(RegExp('^' + indent, 'gm'), indent.slice(0, -2));
});

View File

@@ -262,6 +262,7 @@
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var prop in new ctor) { props.push(prop); }
for (prop in arguments) { }
/**
* Detect if `arguments` objects are `Object` objects (all but Opera < 10.5).
@@ -324,7 +325,7 @@
* @memberOf _.support
* @type Boolean
*/
support.nonEnumArgs = prop == '0';
support.nonEnumArgs = prop != 0;
/**
* Detect if properties shadowing those on `Object.prototype` are non-enumerable.