target-member-identifier-reference-null.js (907B)
1 // Copyright (C) 2021 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-assignment-operators 6 description: Assignment Operator evaluates the value prior validating a MemberExpression's reference (null) 7 info: | 8 # 13.15.2 Runtime Semantics: Evaluation 9 AssignmentExpression : LeftHandSideExpression = AssignmentExpression 10 11 1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, 12 then 13 a. Let lref be the result of evaluating LeftHandSideExpression. 14 [...] 15 e. Perform ? PutValue(lref, rval). 16 17 # 6.2.4.5 PutValue ( V, W ) 18 19 [...] 20 5. If IsPropertyReference(V) is true, then 21 a. Let baseObj be ? ToObject(V.[[Base]]). 22 ---*/ 23 24 var count = 0; 25 var base = null; 26 27 assert.throws(TypeError, function() { 28 base.prop = count += 1; 29 }); 30 31 assert.sameValue(count, 1); 32 33 reportCompare(0, 0);