Merge pull request #273 from anba/assignment-reference

Assignment with left-hand side property accessor
This commit is contained in:
Brian Terlson 2015-06-02 19:09:28 -05:00
commit b3e9752b30
48 changed files with 1568 additions and 0 deletions

View File

@ -0,0 +1,38 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side 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();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] = expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] = expr();
});

View File

@ -0,0 +1,38 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side 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();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] = expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] = expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] = expr();
});

View File

@ -0,0 +1,25 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] = expr();

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
null value.
Check operator is "x ^= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = null;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] ^= expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] ^= expr();
});

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
undefined value.
Check operator is "x ^= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = undefined;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] ^= expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] ^= expr();
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
Check operator is "x ^= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] ^= expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
Check operator is "x ^= y".
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] ^= expr();

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
null value.
Check operator is "x |= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = null;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] |= expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] |= expr();
});

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
undefined value.
Check operator is "x |= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = undefined;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] |= expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] |= expr();
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
Check operator is "x |= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] |= expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
Check operator is "x |= y".
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] |= expr();

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
null value.
Check operator is "x *= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = null;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] *= expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] *= expr();
});

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
undefined value.
Check operator is "x *= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = undefined;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] *= expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] *= expr();
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
Check operator is "x *= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] *= expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
Check operator is "x *= y".
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] *= expr();

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
null value.
Check operator is "x /= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = null;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] /= expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] /= expr();
});

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
undefined value.
Check operator is "x /= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = undefined;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] /= expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] /= expr();
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
Check operator is "x /= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] /= expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
Check operator is "x /= y".
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] /= expr();

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
null value.
Check operator is "x %= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = null;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] %= expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] %= expr();
});

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
undefined value.
Check operator is "x %= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = undefined;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] %= expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] %= expr();
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
Check operator is "x %= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] %= expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
Check operator is "x %= y".
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] %= expr();

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
null value.
Check operator is "x += y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = null;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] += expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] += expr();
});

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
undefined value.
Check operator is "x += y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = undefined;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] += expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] += expr();
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
Check operator is "x += y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] += expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
Check operator is "x += y".
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] += expr();

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
null value.
Check operator is "x -= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = null;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] -= expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] -= expr();
});

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
undefined value.
Check operator is "x -= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = undefined;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] -= expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] -= expr();
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
Check operator is "x -= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] -= expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
Check operator is "x -= y".
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] -= expr();

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
null value.
Check operator is "x <<= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = null;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] <<= expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] <<= expr();
});

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
undefined value.
Check operator is "x <<= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = undefined;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] <<= expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] <<= expr();
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
Check operator is "x <<= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] <<= expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
Check operator is "x <<= y".
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] <<= expr();

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
null value.
Check operator is "x >>= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = null;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] >>= expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] >>= expr();
});

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
undefined value.
Check operator is "x >>= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = undefined;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] >>= expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] >>= expr();
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
Check operator is "x >>= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] >>= expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
Check operator is "x >>= y".
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] >>= expr();

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
null value.
Check operator is "x >>>= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = null;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] >>>= expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] >>>= expr();
});

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
undefined value.
Check operator is "x >>>= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = undefined;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] >>>= expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] >>>= expr();
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
Check operator is "x >>>= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] >>>= expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
Check operator is "x >>>= y".
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] >>>= expr();

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
null value.
Check operator is "x &= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = null;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] &= expr();
});
assert.throws(TypeError, function() {
var base = null;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] &= expr();
});

View File

@ -0,0 +1,39 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. base is the
undefined value.
Check operator is "x &= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = undefined;
var prop = function() {
throw new DummyError();
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop()] &= expr();
});
assert.throws(TypeError, function() {
var base = undefined;
var prop = {
toString: function() {
$ERROR("property key evaluated");
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] &= expr();
});

View File

@ -0,0 +1,27 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. Evaluating
ToPropertyKey(prop) throws an error.
Check operator is "x &= y".
---*/
function DummyError() { }
assert.throws(DummyError, function() {
var base = {};
var prop = {
toString: function() {
throw new DummyError();
}
};
var expr = function() {
$ERROR("right-hand side expression evaluated");
};
base[prop] &= expr();
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Compound Assignment Operator evaluates its operands from left to right.
description: >
The left-hand side expression is evaluated before the right-hand side.
Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop)
is only called once.
Check operator is "x &= y".
---*/
var propKeyEvaluated = false;
var base = {};
var prop = {
toString: function() {
assert(!propKeyEvaluated);
propKeyEvaluated = true;
return "";
}
};
var expr = function() {
return 0;
};
base[prop] &= expr();