Rename top level 'name' and 'length' bindings

Fix 850
This commit is contained in:
Leonardo Balter 2017-03-13 19:45:58 -04:00
parent 238f4caa9a
commit 340543bc11
No known key found for this signature in database
GPG Key ID: 4191D7EB5EC82FF7
16 changed files with 46 additions and 46 deletions

View File

@ -12,14 +12,14 @@ features: [Symbol]
---*/ ---*/
var symbol = Symbol(''); var symbol = Symbol('');
var length = { var len = {
valueOf: function() { valueOf: function() {
throw new Test262Error(); throw new Test262Error();
} }
}; };
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
''.substr(0, length); ''.substr(0, len);
}); });
assert.throws(TypeError, function() { assert.throws(TypeError, function() {

View File

@ -18,18 +18,18 @@ var start = {
throw new Test262Error(); throw new Test262Error();
} }
}; };
var length = { var len = {
valueOf: function() { valueOf: function() {
lengthCallCount += 1; lengthCallCount += 1;
} }
}; };
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
''.substr(start, length); ''.substr(start, len);
}); });
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
''.substr(symbol, length); ''.substr(symbol, len);
}); });
assert.sameValue(lengthCallCount, 0); assert.sameValue(lengthCallCount, 0);

View File

@ -14,25 +14,25 @@ info: >
... ...
---*/ ---*/
var length; var len;
var hits = 0; var hits = 0;
function C(len) { function C(length) {
length = len; len = length;
hits++; hits++;
} }
Array.of.call(C); Array.of.call(C);
assert.sameValue(length, 0, '`Array.of.call(C);` called `new C(0)`'); assert.sameValue(len, 0, '`Array.of.call(C);` called `new C(0)`');
assert.sameValue(hits, 1, 'Called constructor once per call'); assert.sameValue(hits, 1, 'Called constructor once per call');
Array.of.call(C, 'a', 'b') Array.of.call(C, 'a', 'b')
assert.sameValue(length, 2, '`Array.of.call(C, "a", "b"));` called `new C(2)`'); assert.sameValue(len, 2, '`Array.of.call(C, "a", "b"));` called `new C(2)`');
assert.sameValue(hits, 2, 'Called constructor once per call'); assert.sameValue(hits, 2, 'Called constructor once per call');
Array.of.call(C, false, null, undefined); Array.of.call(C, false, null, undefined);
assert.sameValue( assert.sameValue(
length, 3, len, 3,
'`Array.of.call(C, false, null, undefined);` called `new C(3)`' '`Array.of.call(C, false, null, undefined);` called `new C(3)`'
); );
assert.sameValue(hits, 3, 'Called constructor once per call'); assert.sameValue(hits, 3, 'Called constructor once per call');

View File

@ -20,8 +20,8 @@ features: [SharedArrayBuffer]
---*/ ---*/
var buffer = new SharedArrayBuffer(8); var buffer = new SharedArrayBuffer(8);
var length = Symbol("1"); var s = Symbol("1");
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
new DataView(buffer, 0, length); new DataView(buffer, 0, s);
}); });

View File

@ -19,8 +19,8 @@ features: [Symbol]
---*/ ---*/
var buffer = new ArrayBuffer(8); var buffer = new ArrayBuffer(8);
var length = Symbol("1"); var s = Symbol("1");
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
new DataView(buffer, 0, length); new DataView(buffer, 0, s);
}); });

View File

@ -10,7 +10,7 @@ description: First argument is string and null
---*/ ---*/
this.color="red"; this.color="red";
var name="mars"; var planet="mars";
var f = Function.call("blablastring", "return this.color;"); var f = Function.call("blablastring", "return this.color;");
@ -19,7 +19,7 @@ if (f() !== "red") {
$ERROR('#1: '); $ERROR('#1: ');
} }
var g = Function.call(null, "return this.name;"); var g = Function.call(null, "return this.planet;");
//CHECK#2 //CHECK#2
if (g() !== "mars") { if (g() !== "mars") {

View File

@ -43,7 +43,7 @@ includes: [nans.js]
var float = new Float64Array(1); var float = new Float64Array(1);
var ints = new Uint8Array(float.buffer); var ints = new Uint8Array(float.buffer);
var length = distinctNaNs.length; var len = distinctNaNs.length;
var idx, jdx, subject, first, second; var idx, jdx, subject, first, second;
function byteValue(value) { function byteValue(value) {
float[0] = value; float[0] = value;
@ -57,8 +57,8 @@ function byteValue(value) {
* cannot be verified and this test is expected to pass without evaluating any * cannot be verified and this test is expected to pass without evaluating any
* assertions. * assertions.
*/ */
for (idx = 0; idx < length; ++idx) { for (idx = 0; idx < len; ++idx) {
for (jdx = 0 ; jdx < length; ++jdx) { for (jdx = 0 ; jdx < len; ++jdx) {
first = distinctNaNs[idx]; first = distinctNaNs[idx];
second = distinctNaNs[jdx]; second = distinctNaNs[jdx];
if (byteValue(first) === byteValue(second)) { if (byteValue(first) === byteValue(second)) {

View File

@ -21,7 +21,7 @@ features: [SharedArrayBuffer]
---*/ ---*/
var buffer = new SharedArrayBuffer(8); var buffer = new SharedArrayBuffer(8);
var length = { var len = {
valueOf() { valueOf() {
throw new Test262Error(); throw new Test262Error();
} }
@ -29,6 +29,6 @@ var length = {
testWithTypedArrayConstructors(function(TA) { testWithTypedArrayConstructors(function(TA) {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
new TA(buffer, 0, length); new TA(buffer, 0, len);
}); });
}); });

View File

@ -19,7 +19,7 @@ includes: [testTypedArray.js]
---*/ ---*/
var buffer = new ArrayBuffer(8); var buffer = new ArrayBuffer(8);
var length = { var len = {
valueOf() { valueOf() {
throw new Test262Error(); throw new Test262Error();
} }
@ -27,6 +27,6 @@ var length = {
testWithTypedArrayConstructors(function(TA) { testWithTypedArrayConstructors(function(TA) {
assert.throws(Test262Error, function() { assert.throws(Test262Error, function() {
new TA(buffer, 0, length); new TA(buffer, 0, len);
}); });
}); });

View File

@ -21,10 +21,10 @@ features: [SharedArrayBuffer]
---*/ ---*/
var buffer = new SharedArrayBuffer(8); var buffer = new SharedArrayBuffer(8);
var length = Symbol("1"); var s = Symbol("1");
testWithTypedArrayConstructors(function(TA) { testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
new TA(buffer, 0, length); new TA(buffer, 0, s);
}); });
}); });

View File

@ -20,10 +20,10 @@ features: [Symbol]
---*/ ---*/
var buffer = new ArrayBuffer(8); var buffer = new ArrayBuffer(8);
var length = Symbol("1"); var s = Symbol("1");
testWithTypedArrayConstructors(function(TA) { testWithTypedArrayConstructors(function(TA) {
assert.throws(TypeError, function() { assert.throws(TypeError, function() {
new TA(buffer, 0, length); new TA(buffer, 0, s);
}); });
}); });

View File

@ -17,14 +17,14 @@ info: >
includes: [testTypedArray.js] includes: [testTypedArray.js]
---*/ ---*/
var length = 10; var len = 10;
var typedArraySample = new Int8Array(length); var typedArraySample = new Int8Array(len);
testWithTypedArrayConstructors(function(TA) { testWithTypedArrayConstructors(function(TA) {
var typedArray = new TA(typedArraySample); var typedArray = new TA(typedArraySample);
assert.notSameValue(typedArray, typedArraySample); assert.notSameValue(typedArray, typedArraySample);
assert.sameValue(typedArray.length, length); assert.sameValue(typedArray.length, len);
assert.sameValue(typedArray.constructor, TA); assert.sameValue(typedArray.constructor, TA);
assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype); assert.sameValue(Object.getPrototypeOf(typedArray), TA.prototype);
}); });

View File

@ -21,16 +21,16 @@ info: |
features: [let] features: [let]
---*/ ---*/
var name = 'outside'; var n = 'outside';
var probeBefore = function() { return name; }; var probeBefore = function() { return n; };
var probeInside; var probeInside;
// This test intentionally elides parameter expressions because their presence // This test intentionally elides parameter expressions because their presence
// triggers the creation of an additional LexicalEnvironment dedicated to the // triggers the creation of an additional LexicalEnvironment dedicated to the
// function body (see sec-functiondeclarationinstantiation) // function body (see sec-functiondeclarationinstantiation)
var func = function name() { var func = function n() {
let name = 'inside'; let n = 'inside';
probeInside = function() { return name; }; probeInside = function() { return n; };
}; };
func(); func();

View File

@ -20,19 +20,19 @@ info: |
[...] [...]
---*/ ---*/
var name = 'outside'; var n = 'outside';
var probeBefore = function() { return name; }; var probeBefore = function() { return n; };
var probeBody; var probeBody;
// This test intentionally elides parameter expressions because their presence // This test intentionally elides parameter expressions because their presence
// triggers the creation of an additional LexicalEnvironment dedicated to the // triggers the creation of an additional LexicalEnvironment dedicated to the
// function body (see sec-functiondeclarationinstantiation) // function body (see sec-functiondeclarationinstantiation)
var func = function name() { var func = function n() {
// The initializer is intentionally omitted from the following // The initializer is intentionally omitted from the following
// VariableStatement in order to demonstrate that a new binding is created // VariableStatement in order to demonstrate that a new binding is created
// (and not simply re-used from the FunctionExpression's BindingIdentifier). // (and not simply re-used from the FunctionExpression's BindingIdentifier).
var name; var n;
probeBody = function() { return name; }; probeBody = function() { return n; };
}; };
func(); func();

View File

@ -10,8 +10,8 @@ includes: [propertyHelper.js]
features: [Symbol, generators] features: [Symbol, generators]
---*/ ---*/
var name = Symbol('method'); var m = Symbol('method');
var method = { *[name]() {} }[name]; var method = { *[m]() {} }[m];
assert.sameValue(method.name, '[method]'); assert.sameValue(method.name, '[method]');
verifyNotEnumerable(method, 'name'); verifyNotEnumerable(method, 'name');

View File

@ -10,8 +10,8 @@ includes: [propertyHelper.js]
features: [Symbol] features: [Symbol]
---*/ ---*/
var name = Symbol('method'); var m = Symbol('method');
var method = { [name]() {} }[name]; var method = { [m]() {} }[m];
assert.sameValue(method.name, '[method]'); assert.sameValue(method.name, '[method]');
verifyNotEnumerable(method, 'name'); verifyNotEnumerable(method, 'name');