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