Forbidden Extensions: revised to check property existence

This commit is contained in:
Rick Waldron 2020-10-09 09:17:39 -04:00
parent 72154b17fc
commit 0a84a4f176
71 changed files with 1202 additions and 547 deletions

View File

@ -6,14 +6,23 @@ esid: sec-forbidden-extensions
desc: > desc: >
Forbidden extension, f.arguments Forbidden extension, f.arguments
info: | info: |
ECMAScript function objects defined using syntactic constructors in strict mode code must not be created with own properties named "caller" or "arguments". Such own properties also must not be created for function objects defined using an ArrowFunction, MethodDefinition, GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or AsyncArrowFunction regardless of whether the definition is contained in strict mode code. Built-in functions, strict functions created using the Function constructor, generator functions created using the Generator constructor, async functions created using the AsyncFunction constructor, and functions created using the bind method also must not be created with such own properties. ECMAScript function objects defined using syntactic constructors in strict mode code must
not be created with own properties named "caller" or "arguments". Such own properties also
must not be created for function objects defined using an ArrowFunction, MethodDefinition,
GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
Built-in functions, strict functions created using the Function constructor, generator functions
created using the Generator constructor, async functions created using the AsyncFunction
constructor, and functions created using the bind method also must not be created with such own
properties.
flags: [noStrict] flags: [noStrict]
---*/ ---*/
//- function-body //- function-has-forbidden-property
f.arguments; f.hasOwnProperty("arguments")
//- method-body //- method-has-forbidden-property
this.method.arguments; this.method.hasOwnProperty("arguments")
//- error //- error
TypeError TypeError

View File

@ -6,14 +6,23 @@ esid: sec-forbidden-extensions
desc: > desc: >
Forbidden extension, o.caller Forbidden extension, o.caller
info: | info: |
ECMAScript function objects defined using syntactic constructors in strict mode code must not be created with own properties named "caller" or "arguments". Such own properties also must not be created for function objects defined using an ArrowFunction, MethodDefinition, GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or AsyncArrowFunction regardless of whether the definition is contained in strict mode code. Built-in functions, strict functions created using the Function constructor, generator functions created using the Generator constructor, async functions created using the AsyncFunction constructor, and functions created using the bind method also must not be created with such own properties. ECMAScript function objects defined using syntactic constructors in strict mode code must
not be created with own properties named "caller" or "arguments". Such own properties also
must not be created for function objects defined using an ArrowFunction, MethodDefinition,
GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
Built-in functions, strict functions created using the Function constructor, generator functions
created using the Generator constructor, async functions created using the AsyncFunction
constructor, and functions created using the bind method also must not be created with such own
properties.
flags: [noStrict] flags: [noStrict]
---*/ ---*/
//- function-body //- function-has-forbidden-property
f.caller; f.hasOwnProperty("caller")
//- method-body //- method-has-forbidden-property
this.method.caller; this.method.hasOwnProperty("caller")
//- error //- error
TypeError TypeError

View File

@ -0,0 +1,34 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: forbidden-extensions/bullet-two
esid: sec-forbidden-extensions
desc: >
Forbidden extension, o.caller
info: |
If an implementation extends any function object with an own property named "caller" the value of
that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
object. If it is an accessor property, the function that is the value of the property's [[Get]]
attribute must never return a strict function when called.
flags: [noStrict]
---*/
//- setup
var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
function inner() {
// This property may exist, but is forbidden from having a value that is a strict function object
return inner.hasOwnProperty("caller")
? inner.caller
: CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
}
//- define-own-caller
true
//- define-own-caller-descriptor
{get(){return 1}}
//- function-object
f
//- method-object
this.method
//- error
TypeError

View File

@ -0,0 +1,34 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: forbidden-extensions/bullet-two
esid: sec-forbidden-extensions
desc: >
Forbidden extension, o.caller
info: |
If an implementation extends any function object with an own property named "caller" the value of
that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
object. If it is an accessor property, the function that is the value of the property's [[Get]]
attribute must never return a strict function when called.
flags: [noStrict]
---*/
//- setup
var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
function inner() {
// This property may exist, but is forbidden from having a value that is a strict function object
return inner.hasOwnProperty("caller")
? inner.caller
: CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
}
//- define-own-caller
true
//- define-own-caller-descriptor
{value: 1}
//- function-object
f
//- method-object
this.method
//- error
TypeError

View File

@ -6,17 +6,29 @@ esid: sec-forbidden-extensions
desc: > desc: >
Forbidden extension, o.caller Forbidden extension, o.caller
info: | info: |
If an implementation extends any function object with an own property named "caller" the value of that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function object. If it is an accessor property, the function that is the value of the property's [[Get]] attribute must never return a strict function when called. If an implementation extends any function object with an own property named "caller" the value of
that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
object. If it is an accessor property, the function that is the value of the property's [[Get]]
attribute must never return a strict function when called.
flags: [noStrict] flags: [noStrict]
---*/ ---*/
//- setup //- setup
var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
function inner() { function inner() {
// This property is forbidden from having a value that is strict function object // This property may exist, but is forbidden from having a value that is a strict function object
return inner.caller; return inner.hasOwnProperty("caller")
? inner.caller
: CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
} }
//- body //- define-own-caller
inner().toString(); false
//- define-own-caller-descriptor
{}
//- function-object
f
//- method-object
this.method
//- error //- error
TypeError TypeError

View File

@ -6,16 +6,16 @@ name: arrow function expression
esid: sec-arrow-function-definitions-runtime-semantics-evaluation esid: sec-arrow-function-definitions-runtime-semantics-evaluation
info: | info: |
ArrowFunction : ArrowParameters => ConciseBody ArrowFunction : ArrowParameters => ConciseBody
features: [arrow-function]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f; var f;
f = (/*{ params }*/) => { f = (/*{ params }*/) => {
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
}; };
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/); f(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'arrow function body evaluated');
assert.sameValue(callCount, 0, 'arrow function body not evaluated');

View File

@ -14,21 +14,17 @@ info: |
{ AsyncFunctionBody } { AsyncFunctionBody }
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f; var f;
f = async (/*{ params }*/) => { f = async (/*{ params }*/) => {
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
}; };
f(/*{ args }*/) f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,20 +9,16 @@ info: |
AsyncFunctionDeclaration : AsyncFunctionDeclaration :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions]
---*/ ---*/
var callCount = 0; var callCount = 0;
async function f(/*{ params }*/) { async function f() {
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
f(/*{ args }*/) f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,20 +9,16 @@ info: |
AsyncFunctionExpression : AsyncFunctionExpression :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f = async function f(/*{ params }*/) { var f = async function f() {
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
f(/*{ args }*/) f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,20 +9,16 @@ info: |
AsyncFunctionExpression : AsyncFunctionExpression :
async function ( FormalParameters ) { AsyncFunctionBody } async function ( FormalParameters ) { AsyncFunctionBody }
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f = async function(/*{ params }*/) { var f = async function() {
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
f(/*{ args }*/) f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,21 +9,17 @@ info: |
AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody } ( FormalParameters ) { AsyncGeneratorBody }
features: [async-iteration] features: [arrow-function, async-functions, async-iteration]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
async function* f(/*{ params }*/) { async function* f() {
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
f(/*{ args }*/).next() f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,22 +9,18 @@ info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody } AsyncGeneratorBody }
features: [async-iteration] features: [arrow-function, async-functions, async-iteration]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f; var f;
f = async function*(/*{ params }*/) { f = async function*() {
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
}; };
f(/*{ args }*/).next() f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,23 +9,19 @@ info: |
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody } { AsyncGeneratorBody }
features: [async-iteration] features: [arrow-function, async-iteration, generators]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var obj = { var obj = {
async *method(/*{ params }*/) { async *method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
obj.method(/*{ args }*/).next() obj.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,22 +9,18 @@ info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody } ( FormalParameters ) { AsyncGeneratorBody }
features: [async-iteration] features: [arrow-function, async-functions, async-iteration]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f; var f;
f = async function* g(/*{ params }*/) { f = async function* g() {
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
}; };
f(/*{ args }*/).next() f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,23 +9,19 @@ info: |
AsyncMethod : AsyncMethod :
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions]
---*/ ---*/
var callCount = 0; var callCount = 0;
var obj = { var obj = {
async method(/*{ params }*/) { async method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
obj.method(/*{ args }*/) obj.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -7,23 +7,19 @@ name: static class expression generator method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [async-iteration] features: [arrow-function, async-functions, async-iteration, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
static async *method(/*{ params }*/) { static async *method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
} }
C.method(/*{ args }*/).next() C.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -6,23 +6,19 @@ name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [async-iteration] features: [arrow-function, async-functions, async-iteration, class, generators]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
async *method(/*{ params }*/) { async *method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
} }
C.prototype.method(/*{ args }*/).next() C.prototype.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -7,23 +7,19 @@ name: static class declaration async method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [async-functions] features: [arrow-function, async-functions, async-iteration, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
static async method(/*{ params }*/) { static async method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
} }
C.method(/*{ args }*/) C.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -8,22 +8,18 @@ esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions, class]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
async method(/*{ params }*/) { async method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
} }
C.prototype.method(/*{ args }*/) C.prototype.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -6,19 +6,17 @@ name: static class expression generator method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [generators] features: [class, generators]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
static *method(/*{ params }*/) { static *method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
} }
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/).next(); C.method(/*{ args }*/).next();
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,18 +6,16 @@ name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [generators] features: [class, generators]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
*method(/*{ params }*/) { *method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
} }
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/).next(); C.prototype.method(/*{ args }*/).next();
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,17 +6,16 @@ name: static class expression method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [class]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
static method(/*{ params }*/) { static method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
} }
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/); C.method(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,17 +6,16 @@ name: class expression method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [class]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
method(/*{ params }*/) { method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
} }
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/); C.prototype.method(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,23 +6,19 @@ name: static class expression async generator method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [async-iteration] features: [arrow-function, async-functions, async-iteration, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
static async *method(/*{ params }*/) { static async *method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
C.method(/*{ args }*/).next() C.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -6,23 +6,19 @@ name: class expression async generator method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [async-iteration] features: [arrow-function, async-functions, async-iteration, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
async *method(/*{ params }*/) { async *method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
C.prototype.method(/*{ args }*/).next() C.prototype.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -7,24 +7,20 @@ name: static class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [async-functions] features: [arrow-function, async-functions, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
static async method(/*{ params }*/) { static async method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
C.method(/*{ args }*/) C.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -7,23 +7,19 @@ name: class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [async-functions] features: [arrow-function, async-functions, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
async method(/*{ params }*/) { async method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
C.prototype.method(/*{ args }*/) C.prototype.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -6,18 +6,16 @@ name: static class expression generator method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [generators] features: [class, generators]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
static *method(/*{ params }*/) { static *method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/).next(); C.method(/*{ args }*/).next();
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,18 +6,16 @@ name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [generators] features: [class, generators]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
*method(/*{ params }*/) { *method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/).next(); C.prototype.method(/*{ args }*/).next();
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,17 +6,16 @@ name: static class expression method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [class]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
static method(/*{ params }*/) { static method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/); C.method(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,17 +6,16 @@ name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [class]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
method(/*{ params }*/) { method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/); C.prototype.method(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -10,12 +10,11 @@ info: |
---*/ ---*/
var callCount = 0; var callCount = 0;
function f(/*{ params }*/) { function f() {
"use strict"; "use strict";
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/); f(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'function body evaluated');
assert.sameValue(callCount, 0, 'function body not evaluated');

View File

@ -1,21 +0,0 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/function/forbidden-ext/b1/func-decl-
name: function declaration
esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject
info: |
FunctionDeclaration :
function BindingIdentifier ( FormalParameters ) { FunctionBody }
In non-strict mode code, a function object created using the FunctionDeclaration
syntactic constructor, is not subject to the following forbidden extension:
---*/
var callCount = 0;
function f(/*{ params }*/) {
/*{ function-body }*/
callCount++;
}
f(/*{ args }*/);
assert.sameValue(callCount, 1, 'function was evaluated');

View File

@ -10,12 +10,11 @@ info: |
var callCount = 0; var callCount = 0;
var f; var f;
f = function(/*{ params }*/) { f = function() {
"use strict"; "use strict";
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
}; };
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/); f(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'function body evaluated');
assert.sameValue(callCount, 0, 'function body not evaluated');

View File

@ -1,22 +0,0 @@
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/function/forbidden-ext/b1/func-expr-
name: function expression
esid: sec-function-definitions-runtime-semantics-evaluation
info: |
FunctionExpression : function ( FormalParameters ) { FunctionBody }
In non-strict mode code, a function object created using the FunctionExpression
syntactic constructor, is not subject to the following forbidden extension:
---*/
var callCount = 0;
var f;
f = function(/*{ params }*/) {
/*{ function-body }*/
callCount++;
};
f(/*{ args }*/);
assert.sameValue(callCount, 1, 'function was evaluated');

View File

@ -10,13 +10,11 @@ features: [generators]
---*/ ---*/
var callCount = 0; var callCount = 0;
function* f(/*{ params }*/) { function* f() {
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/).next(); f(/*{ args }*/).next();
}); assert.sameValue(callCount, 1, 'generator function body evaluated');
assert.sameValue(callCount, 0, 'generator function body not evaluated');

View File

@ -11,12 +11,11 @@ features: [generators]
var callCount = 0; var callCount = 0;
var f; var f;
f = function*(/*{ params }*/) { f = function*() {
/*{ function-body }*/ assert.sameValue(/*{ function-has-forbidden-property }*/, false);
callCount++; callCount++;
}; };
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/).next(); f(/*{ args }*/).next();
}); assert.sameValue(callCount, 1, 'generator function body evaluated');
assert.sameValue(callCount, 0, 'generator function body not evaluated');

View File

@ -13,13 +13,11 @@ features: [generators]
var callCount = 0; var callCount = 0;
var obj = { var obj = {
*method(/*{ params }*/) { *method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() {
obj.method(/*{ args }*/).next(); obj.method(/*{ args }*/).next();
}); assert.sameValue(callCount, 1, 'generator method body evaluated');
assert.sameValue(callCount, 0, 'generator method body not evaluated');

View File

@ -10,13 +10,11 @@ info: |
var callCount = 0; var callCount = 0;
var obj = { var obj = {
method(/*{ params }*/) { method() {
/*{ method-body }*/ assert.sameValue(/*{ method-has-forbidden-property }*/, false);
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() {
obj.method(/*{ args }*/); obj.method(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,17 +6,40 @@ name: arrow function expression
esid: sec-arrow-definitions-runtime-semantics-evaluation esid: sec-arrow-definitions-runtime-semantics-evaluation
info: | info: |
ArrowFunction : ArrowParameters => ConciseBody ArrowFunction : ArrowParameters => ConciseBody
features: [arrow-function]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f; var f;
f = (/*{ params }*/) => { f = (/*{ params }*/) => {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
}; };
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/); f(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'arrow function body evaluated');
assert.sameValue(callCount, 0, 'arrow function body not evaluated');

View File

@ -14,22 +14,42 @@ info: |
{ AsyncFunctionBody } { AsyncFunctionBody }
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f; var f;
f = async (/*{ params }*/) => { f = async (/*{ params }*/) => {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
}; };
f(/*{ args }*/) f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,21 +9,41 @@ info: |
AsyncFunctionDeclaration : AsyncFunctionDeclaration :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions]
---*/ ---*/
var callCount = 0; var callCount = 0;
async function f(/*{ params }*/) { async function f() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
} }
f(/*{ args }*/) f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,21 +9,42 @@ info: |
AsyncFunctionExpression : AsyncFunctionExpression :
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f = async function f(/*{ params }*/) { var f;
f = async function f() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
} }
f(/*{ args }*/) f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,21 +9,42 @@ info: |
AsyncFunctionExpression : AsyncFunctionExpression :
async function ( FormalParameters ) { AsyncFunctionBody } async function ( FormalParameters ) { AsyncFunctionBody }
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f = async function(/*{ params }*/) { var f;
f = async function() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
} }
f(/*{ args }*/) f(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,22 +9,42 @@ info: |
AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody } ( FormalParameters ) { AsyncGeneratorBody }
features: [async-iteration] features: [arrow-function, async-functions, async-iteration]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
async function* f(/*{ params }*/) { async function* f() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
} }
f(/*{ args }*/).next() f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,23 +9,43 @@ info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody } AsyncGeneratorBody }
features: [async-iteration] features: [arrow-function, async-functions, async-iteration]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f; var f;
f = async function*(/*{ params }*/) { f = async function*() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
}; };
f(/*{ args }*/).next() f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,24 +9,44 @@ info: |
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody } { AsyncGeneratorBody }
features: [async-iteration] features: [arrow-function, async-iteration, generators]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var obj = { var obj = {
async *method(/*{ params }*/) { async *method() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
obj.method(/*{ args }*/).next() obj.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,23 +9,43 @@ info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody } ( FormalParameters ) { AsyncGeneratorBody }
features: [async-iteration] features: [arrow-function, async-functions, async-iteration]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var f; var f;
f = async function* g(/*{ params }*/) { f = async function* g() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
}; };
f(/*{ args }*/).next() f(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -9,24 +9,44 @@ info: |
AsyncMethod : AsyncMethod :
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions]
---*/ ---*/
var callCount = 0; var callCount = 0;
var obj = { var obj = {
async method(/*{ params }*/) { async method() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
obj.method(/*{ args }*/) obj.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -7,24 +7,44 @@ name: static class expression generator method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [async-iteration] features: [arrow-function, async-functions, async-iteration, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
static async *method(/*{ params }*/) { static async *method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
} }
C.method(/*{ args }*/).next() C.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -6,24 +6,44 @@ name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [async-iteration] features: [arrow-function, async-functions, async-iteration, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
async *method(/*{ params }*/) { async *method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
} }
C.prototype.method(/*{ args }*/).next() C.prototype.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -7,24 +7,44 @@ name: static class declaration async method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [async-functions] features: [arrow-function, async-functions, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
static async method(/*{ params }*/) { static async method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
} }
C.method(/*{ args }*/) C.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -8,23 +8,43 @@ esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
flags: [async] flags: [async]
features: [async-functions] features: [arrow-function, async-functions, class]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
async method(/*{ params }*/) { async method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
} }
C.prototype.method(/*{ args }*/) C.prototype.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -6,20 +6,42 @@ name: static class expression generator method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [generators] features: [class, generators]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
static *method(/*{ params }*/) { static *method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
} }
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/).next(); C.method(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'method body not evaluated'); assert.sameValue(callCount, 1, 'method body evaluated');

View File

@ -6,19 +6,41 @@ name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [generators] features: [class, generators]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
*method(/*{ params }*/) { *method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
} }
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/).next(); C.prototype.method(/*{ args }*/).next();
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,18 +6,41 @@ name: static class expression method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [class]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
static method(/*{ params }*/) { static method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
} }
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/); C.method(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,18 +6,41 @@ name: class expression method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation esid: sec-runtime-semantics-bindingclassdeclarationevaluation
info: | info: |
ClassDeclaration : class BindingIdentifier ClassTail ClassDeclaration : class BindingIdentifier ClassTail
features: [class]
---*/ ---*/
var callCount = 0; var callCount = 0;
class C { class C {
method(/*{ params }*/) { method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
} }
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/); C.prototype.method(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,24 +6,44 @@ name: static class expression async generator method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [async-iteration] features: [arrow-function, async-functions, async-iteration, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
static async *method(/*{ params }*/) { static async *method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
C.method(/*{ args }*/).next() C.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -6,24 +6,44 @@ name: class expression async generator method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [async-iteration] features: [arrow-function, async-functions, async-iteration, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
async *method(/*{ params }*/) { async *method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
C.prototype.method(/*{ args }*/).next() C.prototype.method(/*{ args }*/).next()
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -7,25 +7,45 @@ name: static class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [async-functions] features: [arrow-function, async-functions, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
static async method(/*{ params }*/) { static async method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
C.method(/*{ args }*/) C.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -7,24 +7,44 @@ name: class expression async method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [async-functions] features: [arrow-function, async-functions, class]
flags: [async] flags: [async]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
async method(/*{ params }*/) { async method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
C.prototype.method(/*{ args }*/) C.prototype.method(/*{ args }*/)
.then(_ => {
throw new Test262Error('function should not be resolved');
}, error => assert.sameValue(error.constructor, /*{ error }*/))
.then(() => { .then(() => {
assert.sameValue(callCount, 0, 'function body is not evaluated'); assert.sameValue(callCount, 1, 'function body evaluated');
}, $DONE) }, $DONE).then($DONE, $DONE);
.then($DONE, $DONE);

View File

@ -6,19 +6,41 @@ name: static class expression generator method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [generators] features: [class, generators]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
static *method(/*{ params }*/) { static *method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/).next(); C.method(/*{ args }*/).next();
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,19 +6,42 @@ name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [generators] features: [class, generators]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
*method(/*{ params }*/) { *method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/).next(); C.prototype.method(/*{ args }*/).next();
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,18 +6,42 @@ name: static class expression method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [class]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
static method(/*{ params }*/) { static method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() {
C.method(/*{ args }*/); C.method(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -6,18 +6,42 @@ name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation esid: sec-class-definitions-runtime-semantics-evaluation
info: | info: |
ClassExpression : class BindingIdentifieropt ClassTail ClassExpression : class BindingIdentifieropt ClassTail
features: [class]
---*/ ---*/
var callCount = 0; var callCount = 0;
var C = class { var C = class {
method(/*{ params }*/) { method() {
/* implicit strict */ /* implicit strict */
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() {
C.prototype.method(/*{ args }*/); C.prototype.method(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -10,12 +10,36 @@ info: |
---*/ ---*/
var callCount = 0; var callCount = 0;
function f(/*{ params }*/) { function f() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
} }
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/); f(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -10,12 +10,36 @@ info: |
var callCount = 0; var callCount = 0;
var f; var f;
f = function(/*{ params }*/) { f = function() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
}; };
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/); f(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');

View File

@ -10,14 +10,38 @@ features: [generators]
---*/ ---*/
var callCount = 0; var callCount = 0;
function* f(/*{ params }*/) { function* f() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
} }
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/).next(); f(/*{ args }*/).next();
});
assert.sameValue(callCount, 0, 'generator function body not evaluated'); assert.sameValue(callCount, 1, 'generator function body evaluated');

View File

@ -11,13 +11,37 @@ features: [generators]
var callCount = 0; var callCount = 0;
var f; var f;
f = function*(/*{ params }*/) { f = function*() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
// the same templates.
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ function-object }*/);
}
callCount++; callCount++;
}; };
assert.throws(/*{ error }*/, function() {
f(/*{ args }*/).next(); f(/*{ args }*/).next();
}); assert.sameValue(callCount, 1, 'generator function body evaluated');
assert.sameValue(callCount, 0, 'generator function body not evaluated');

View File

@ -13,14 +13,36 @@ features: [generators]
var callCount = 0; var callCount = 0;
var obj = { var obj = {
*method(/*{ params }*/) { *method() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() { obj.method(/*{ args }*/).next().value;
obj.method(/*{ args }*/).next(); assert.sameValue(callCount, 1, 'generator method body was evaluated');
});
assert.sameValue(callCount, 0, 'generator method body not evaluated');

View File

@ -10,14 +10,37 @@ info: |
var callCount = 0; var callCount = 0;
var obj = { var obj = {
method(/*{ params }*/) { method() {
"use strict"; "use strict";
/*{ body }*/ // This and the following conditional value is set in the test's .case file.
// For every test that has a "true" value here, there is a
// corresponding test that has a "false" value here.
// They are generated from two different case files, which use
let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/);
}
var result = inner();
if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) {
assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
}
// "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
// forbidden-ext-indirect-access-prop-caller.case
//
// If the function object "inner" has an own property
// named "caller", then its value will be returned.
//
// If the function object "inner" DOES NOT have an
// own property named "caller", then the symbol
// CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
assert.notSameValue(result, /*{ method-object }*/);
}
callCount++; callCount++;
} }
}; };
assert.throws(/*{ error }*/, function() {
obj.method(/*{ args }*/); obj.method(/*{ args }*/);
}); assert.sameValue(callCount, 1, 'method body evaluated');
assert.sameValue(callCount, 0, 'method body not evaluated');