mirror of
https://github.com/tc39/test262.git
synced 2025-07-01 03:04:42 +02:00
Merge pull request #275 from anba/increment-reference
Increment/Decrement with property accessor expression
This commit is contained in:
commit
f41d108840
31
test/language/expressions/postfix-decrement/S11.3.2_A6_T1.js
Executable file
31
test/language/expressions/postfix-decrement/S11.3.2_A6_T1.js
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator x-- evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. base is the null value.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function DummyError() { }
|
||||||
|
|
||||||
|
assert.throws(DummyError, function() {
|
||||||
|
var base = null;
|
||||||
|
var prop = function() {
|
||||||
|
throw new DummyError();
|
||||||
|
};
|
||||||
|
|
||||||
|
base[prop()]--;
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
var base = null;
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
$ERROR("property key evaluated");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
base[prop]--;
|
||||||
|
});
|
31
test/language/expressions/postfix-decrement/S11.3.2_A6_T2.js
Executable file
31
test/language/expressions/postfix-decrement/S11.3.2_A6_T2.js
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator x-- evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. base is the undefined value.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function DummyError() { }
|
||||||
|
|
||||||
|
assert.throws(DummyError, function() {
|
||||||
|
var base = undefined;
|
||||||
|
var prop = function() {
|
||||||
|
throw new DummyError();
|
||||||
|
};
|
||||||
|
|
||||||
|
base[prop()]--;
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
var base = undefined;
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
$ERROR("property key evaluated");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
base[prop]--;
|
||||||
|
});
|
22
test/language/expressions/postfix-decrement/S11.3.2_A6_T3.js
Executable file
22
test/language/expressions/postfix-decrement/S11.3.2_A6_T3.js
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator x-- evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. ToPropertyKey(prop) is not called multiple
|
||||||
|
times.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var propKeyEvaluated = false;
|
||||||
|
var base = {};
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
assert(!propKeyEvaluated);
|
||||||
|
propKeyEvaluated = true;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
base[prop]--;
|
31
test/language/expressions/postfix-increment/S11.3.1_A6_T1.js
Executable file
31
test/language/expressions/postfix-increment/S11.3.1_A6_T1.js
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator x++ evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. base is the null value.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function DummyError() { }
|
||||||
|
|
||||||
|
assert.throws(DummyError, function() {
|
||||||
|
var base = null;
|
||||||
|
var prop = function() {
|
||||||
|
throw new DummyError();
|
||||||
|
};
|
||||||
|
|
||||||
|
base[prop()]++;
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
var base = null;
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
$ERROR("property key evaluated");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
base[prop]++;
|
||||||
|
});
|
31
test/language/expressions/postfix-increment/S11.3.1_A6_T2.js
Executable file
31
test/language/expressions/postfix-increment/S11.3.1_A6_T2.js
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator x++ evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. base is the undefined value.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function DummyError() { }
|
||||||
|
|
||||||
|
assert.throws(DummyError, function() {
|
||||||
|
var base = undefined;
|
||||||
|
var prop = function() {
|
||||||
|
throw new DummyError();
|
||||||
|
};
|
||||||
|
|
||||||
|
base[prop()]++;
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
var base = undefined;
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
$ERROR("property key evaluated");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
base[prop]++;
|
||||||
|
});
|
22
test/language/expressions/postfix-increment/S11.3.1_A6_T3.js
Executable file
22
test/language/expressions/postfix-increment/S11.3.1_A6_T3.js
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator x++ evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. ToPropertyKey(prop) is not called multiple
|
||||||
|
times.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var propKeyEvaluated = false;
|
||||||
|
var base = {};
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
assert(!propKeyEvaluated);
|
||||||
|
propKeyEvaluated = true;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
base[prop]++;
|
31
test/language/expressions/prefix-decrement/S11.4.5_A6_T1.js
Executable file
31
test/language/expressions/prefix-decrement/S11.4.5_A6_T1.js
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator --x evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. base is the null value.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function DummyError() { }
|
||||||
|
|
||||||
|
assert.throws(DummyError, function() {
|
||||||
|
var base = null;
|
||||||
|
var prop = function() {
|
||||||
|
throw new DummyError();
|
||||||
|
};
|
||||||
|
|
||||||
|
--base[prop()];
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
var base = null;
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
$ERROR("property key evaluated");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
--base[prop];
|
||||||
|
});
|
31
test/language/expressions/prefix-decrement/S11.4.5_A6_T2.js
Executable file
31
test/language/expressions/prefix-decrement/S11.4.5_A6_T2.js
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator --x evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. base is the undefined value.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function DummyError() { }
|
||||||
|
|
||||||
|
assert.throws(DummyError, function() {
|
||||||
|
var base = undefined;
|
||||||
|
var prop = function() {
|
||||||
|
throw new DummyError();
|
||||||
|
};
|
||||||
|
|
||||||
|
--base[prop()];
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
var base = undefined;
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
$ERROR("property key evaluated");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
--base[prop];
|
||||||
|
});
|
22
test/language/expressions/prefix-decrement/S11.4.5_A6_T3.js
Executable file
22
test/language/expressions/prefix-decrement/S11.4.5_A6_T3.js
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator --x evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. ToPropertyKey(prop) is not called multiple
|
||||||
|
times.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var propKeyEvaluated = false;
|
||||||
|
var base = {};
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
assert(!propKeyEvaluated);
|
||||||
|
propKeyEvaluated = true;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
--base[prop];
|
31
test/language/expressions/prefix-increment/S11.4.4_A6_T1.js
Executable file
31
test/language/expressions/prefix-increment/S11.4.4_A6_T1.js
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator ++x evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. base is the null value.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function DummyError() { }
|
||||||
|
|
||||||
|
assert.throws(DummyError, function() {
|
||||||
|
var base = null;
|
||||||
|
var prop = function() {
|
||||||
|
throw new DummyError();
|
||||||
|
};
|
||||||
|
|
||||||
|
++base[prop()];
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
var base = null;
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
$ERROR("property key evaluated");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
++base[prop];
|
||||||
|
});
|
31
test/language/expressions/prefix-increment/S11.4.4_A6_T2.js
Executable file
31
test/language/expressions/prefix-increment/S11.4.4_A6_T2.js
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator ++x evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. base is the undefined value.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function DummyError() { }
|
||||||
|
|
||||||
|
assert.throws(DummyError, function() {
|
||||||
|
var base = undefined;
|
||||||
|
var prop = function() {
|
||||||
|
throw new DummyError();
|
||||||
|
};
|
||||||
|
|
||||||
|
++base[prop()];
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
var base = undefined;
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
$ERROR("property key evaluated");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
++base[prop];
|
||||||
|
});
|
22
test/language/expressions/prefix-increment/S11.4.4_A6_T3.js
Executable file
22
test/language/expressions/prefix-increment/S11.4.4_A6_T3.js
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
info: Operator ++x evaluates its reference expression once.
|
||||||
|
description: >
|
||||||
|
The operand expression is evaluated exactly once. Operand expression is
|
||||||
|
MemberExpression: base[prop]. ToPropertyKey(prop) is not called multiple
|
||||||
|
times.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var propKeyEvaluated = false;
|
||||||
|
var base = {};
|
||||||
|
var prop = {
|
||||||
|
toString: function() {
|
||||||
|
assert(!propKeyEvaluated);
|
||||||
|
propKeyEvaluated = true;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
++base[prop];
|
Loading…
x
Reference in New Issue
Block a user