eval-strictness-inherit-non-strict.js (909B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 description: Evaluated code honors the strictness of the calling context 5 esid: sec-function-calls-runtime-semantics-evaluation 6 info: | 7 [...] 8 3. If Type(ref) is Reference and IsPropertyReference(ref) is false and 9 GetReferencedName(ref) is "eval", then 10 a. If SameValue(func, %eval%) is true, then 11 [...] 12 iv. If the source code matching this CallExpression is strict code, 13 let strictCaller be true. Otherwise let strictCaller be false. 14 [...] 15 flags: [noStrict] 16 ---*/ 17 18 var count = 0; 19 20 eval('var static; count += 1;'); 21 22 assert.sameValue(count, 1); 23 24 eval('with ({}) {} count += 1;'); 25 26 assert.sameValue(count, 2); 27 28 eval('unresolvable = null; count += 1;'); 29 30 assert.sameValue(count, 3); 31 32 reportCompare(0, 0);