Debian Codegraph @

js/src/tests/test262/language/expressions/function/forbidden-ext/b1/func-expr-strict-forbidden-ext-direct-access-prop-caller.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/function-forms/forbidden-ext-direct-access-prop-caller.case
3 // - src/function-forms/forbidden-extensions/bullet-one/func-expr-strict.template
4 /*---
5 description: Forbidden extension, o.caller (function expression)
6 esid: sec-function-definitions-runtime-semantics-evaluation
7 flags: [generated, noStrict]
8 info: |
9 FunctionExpression : function ( FormalParameters ) { FunctionBody }
10
11 ECMAScript function objects defined using syntactic constructors in strict mode code must
12 not be created with own properties named "caller" or "arguments". Such own properties also
13 must not be created for function objects defined using an ArrowFunction, MethodDefinition,
14 GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
15 ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
16 AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
17 Built-in functions, strict functions created using the Function constructor, generator functions
18 created using the Generator constructor, async functions created using the AsyncFunction
19 constructor, and functions created using the bind method also must not be created with such own
20 properties.
21
22 ---*/
23
24 var callCount = 0;
25 var f;
26 f = function() {
27 "use strict";
28 assert.sameValue(f.hasOwnProperty("caller"), false);
29 callCount++;
30 };
31
32 f();
33 assert.sameValue(callCount, 1, 'function body evaluated');
34
35 reportCompare(0, 0);