| 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: [onlyStrict] |
| 16 |
---*/ |
| 17 |
|
| 18 |
assert.throws(SyntaxError, function() { |
| 19 |
eval('var static;'); |
| 20 |
}); |
| 21 |
|
| 22 |
assert.throws(SyntaxError, function() { |
| 23 |
eval('with ({}) {}'); |
| 24 |
}); |
| 25 |
|
| 26 |
assert.throws(ReferenceError, function() { |
| 27 |
eval('unresolvable = null;'); |
| 28 |
}); |