mirror of https://github.com/tc39/test262.git
Merge pull request #275 from anba/increment-reference
Increment/Decrement with property accessor expression
This commit is contained in:
commit
f41d108840
|
@ -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]--;
|
||||||
|
});
|
|
@ -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]--;
|
||||||
|
});
|
|
@ -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]--;
|
|
@ -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]++;
|
||||||
|
});
|
|
@ -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]++;
|
||||||
|
});
|
|
@ -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]++;
|
|
@ -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];
|
||||||
|
});
|
|
@ -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];
|
||||||
|
});
|
|
@ -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];
|
|
@ -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];
|
||||||
|
});
|
|
@ -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];
|
||||||
|
});
|
|
@ -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…
Reference in New Issue