| 1 |
// Copyright (C) 2015 André Bargull. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
es6id: 18.2.1.2 |
| 6 |
description: Global functions are not created if conflicting function declarations were detected. |
| 7 |
info: | |
| 8 |
Runtime Semantics: EvalDeclarationInstantiation( body, varEnv, lexEnv, strict) |
| 9 |
|
| 10 |
... |
| 11 |
8. For each d in varDeclarations, in reverse list order do |
| 12 |
a. If d is neither a VariableDeclaration or a ForBinding, then |
| 13 |
i. Assert: d is either a FunctionDeclaration or a GeneratorDeclaration. |
| 14 |
ii. NOTE If there are multiple FunctionDeclarations for the same name, the last declaration is used. |
| 15 |
iii. Let fn be the sole element of the BoundNames of d. |
| 16 |
iv. If fn is not an element of declaredFunctionNames, then |
| 17 |
1. If varEnvRec is a global Environment Record, then |
| 18 |
a. Let fnDefinable be varEnvRec.CanDeclareGlobalFunction(fn). |
| 19 |
b. ReturnIfAbrupt(fnDefinable). |
| 20 |
c. If fnDefinable is false, throw TypeError exception. |
| 21 |
... |
| 22 |
14. For each production f in functionsToInitialize, do |
| 23 |
a. Let fn be the sole element of the BoundNames of f. |
| 24 |
b. Let fo be the result of performing InstantiateFunctionObject for f with argument lexEnv. |
| 25 |
c. If varEnvRec is a global Environment Record, then |
| 26 |
i. Let status be varEnvRec.CreateGlobalFunctionBinding(fn, fo, true). |
| 27 |
ii. ReturnIfAbrupt(status). |
| 28 |
... |
| 29 |
flags: [noStrict] |
| 30 |
---*/ |
| 31 |
|
| 32 |
try { |
| 33 |
eval("function shouldNotBeDefined(){} function NaN(){}"); |
| 34 |
} catch (e) { |
| 35 |
// Ignore TypeError exception. |
| 36 |
} |
| 37 |
|
| 38 |
assert.sameValue(Object.getOwnPropertyDescriptor(this, "shouldNotBeDefined"), undefined); |
| 39 |
|
| 40 |
reportCompare(0, 0); |