| 1 |
// Copyright (C) 2017 André Bargull. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
esid: sec-function-calls-runtime-semantics-evaluation |
| 6 |
description: > |
| 7 |
Direct eval call with empty leading spread. |
| 8 |
info: | |
| 9 |
12.3.4.1 Runtime Semantics: Evaluation |
| 10 |
... |
| 11 |
3. If Type(ref) is Reference and IsPropertyReference(ref) is false and GetReferencedName(ref) is "eval", then |
| 12 |
a. If SameValue(func, %eval%) is true, then |
| 13 |
i. Let argList be ? ArgumentListEvaluation(Arguments). |
| 14 |
ii. If argList has no elements, return undefined. |
| 15 |
iii. Let evalText be the first element of argList. |
| 16 |
... |
| 17 |
|
| 18 |
features: [Symbol.iterator] |
| 19 |
---*/ |
| 20 |
|
| 21 |
var nextCount = 0; |
| 22 |
var iter = {}; |
| 23 |
iter[Symbol.iterator] = function() { |
| 24 |
return { |
| 25 |
next: function() { |
| 26 |
var i = nextCount++; |
| 27 |
return {done: true, value: undefined}; |
| 28 |
} |
| 29 |
}; |
| 30 |
}; |
| 31 |
|
| 32 |
var x = "global"; |
| 33 |
|
| 34 |
(function() { |
| 35 |
var x = "local"; |
| 36 |
eval(...iter, "x = 0;"); |
| 37 |
assert.sameValue(x, 0); |
| 38 |
})(); |
| 39 |
|
| 40 |
assert.sameValue(x, "global"); |
| 41 |
assert.sameValue(nextCount, 1); |