mirror of https://github.com/tc39/test262.git
Add tests for MethodDefinition forms new to ES6
This commit is contained in:
parent
cde990b79c
commit
31bdf48bec
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Generator functions declared as methods may be used as constructors.
|
||||
es6id: 14.4.13
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var method = { *method() {} }.method;
|
||||
|
||||
var instance = new method();
|
||||
|
||||
assert.sameValue(instance instanceof method, true);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
In the absence of the "use strict" directive, generator functions declared
|
||||
as methods obey "global" ThisMode semantics.
|
||||
es6id: 14.4.13
|
||||
flags: [noStrict]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var global = (function() { return this; }());
|
||||
var thisValue = null;
|
||||
var method = {
|
||||
*method() {
|
||||
thisValue = this;
|
||||
}
|
||||
}.method;
|
||||
|
||||
method().next();
|
||||
|
||||
assert.sameValue(thisValue, global);
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
In the presence of the "use strict" directive, generator functions declared
|
||||
as methods obey "strict" ThisMode semantics.
|
||||
es6id: 14.4.13
|
||||
flags: [noStrict]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var thisValue = null;
|
||||
var method = {
|
||||
*method() {
|
||||
'use strict';
|
||||
thisValue = this;
|
||||
}
|
||||
}.method;
|
||||
|
||||
method().next();
|
||||
|
||||
assert.sameValue(thisValue, undefined);
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Generator functions declared as methods have a `length` property that
|
||||
describes the number of formal parameters.
|
||||
es6id: 14.4.13
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var method = { *method(a, b, c) {} }.method;
|
||||
|
||||
assert.sameValue(method.length, 3);
|
||||
verifyNotEnumerable(method, 'length');
|
||||
verifyNotWritable(method, 'length');
|
||||
verifyConfigurable(method, 'length');
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Generator functions declared as methods are assigned a `name` property
|
||||
according to the string value of their property name.
|
||||
es6id: 14.4.13
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var method = { *method() {} }.method;
|
||||
|
||||
assert.sameValue(method.name, 'method');
|
||||
verifyNotEnumerable(method, 'name');
|
||||
verifyNotWritable(method, 'name');
|
||||
verifyConfigurable(method, 'name');
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Generator functions declared as methods are assigned a `name` property
|
||||
according to the string value of their property name.
|
||||
es6id: 14.4.13
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol, generators]
|
||||
---*/
|
||||
|
||||
var name = Symbol('method');
|
||||
var method = { *[name]() {} }[name];
|
||||
|
||||
assert.sameValue(method.name, '[method]');
|
||||
verifyNotEnumerable(method, 'name');
|
||||
verifyNotWritable(method, 'name');
|
||||
verifyConfigurable(method, 'name');
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
The BindingIdentifier of a SingleNameBinding witihn the FormalParameters of
|
||||
a GeneratorMethod may not be the `yield` keyword.
|
||||
es6id: 14.4
|
||||
features: [generators]
|
||||
flags: [noStrict]
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
({
|
||||
*method(yield) {}
|
||||
});
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
When the `yield` keyword occurs within the Initializer of a
|
||||
SingleNameBinding witihn the FormalParameters of a GeneratorMethod, it
|
||||
behaves as a YieldExpression.
|
||||
es6id: 14.4
|
||||
features: [generators]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var yield = 'defaultViaIdentifier';
|
||||
var obj;
|
||||
var iter = (function*() {
|
||||
obj = {
|
||||
*method(x = yield) {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
}());
|
||||
|
||||
iter.next();
|
||||
|
||||
iter.next('defaultViaExpression');
|
||||
|
||||
assert.sameValue(obj.method().next(), 'defaultViaExpression');
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Generator functions declared as methods honor their declared formal
|
||||
parameters.
|
||||
es6id: 14.4.13
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var value1 = {};
|
||||
var value2 = {};
|
||||
var value3 = {};
|
||||
var arg1, arg2, arg3;
|
||||
var obj = {
|
||||
*method(a, b, c) {
|
||||
arg1 = a;
|
||||
arg2 = b;
|
||||
arg3 = c;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method(value1, value2, value3).next();
|
||||
|
||||
assert.sameValue(arg1, value1);
|
||||
assert.sameValue(arg2, value2);
|
||||
assert.sameValue(arg3, value3);
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Errors thrown during method definition are forwarded to the runtime.
|
||||
es6id: 14.4.13
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
({
|
||||
*[(function() { throw new Test262Error(); }())]() {}
|
||||
});
|
||||
});
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
When the `yield` keyword occurs within the PropertyName of a
|
||||
GeneratorMethod within a generator function, it behaves as a
|
||||
YieldExpression.
|
||||
es6id: 14.4
|
||||
features: [generators]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var obj = null;
|
||||
var yield = 'propNameViaIdentifier';
|
||||
var iter = (function*() {
|
||||
obj = {
|
||||
*[yield]() {}
|
||||
};
|
||||
})();
|
||||
|
||||
iter.next();
|
||||
|
||||
assert.sameValue(obj, null);
|
||||
|
||||
iter.next('propNameViaExpression');
|
||||
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, 'propNameViaIdentifier'), false
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, 'propNameViaExpression'), true
|
||||
);
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
When the `yield` keyword occurs within the PropertyName of a
|
||||
GeneratorMethod outside of a generator function, it behaves as an
|
||||
Identifier.
|
||||
es6id: 14.4
|
||||
features: [generators]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var yield = 'propName';
|
||||
var obj = {
|
||||
*[yield]() {}
|
||||
};
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(obj, 'propName'), true);
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Generator functions declared as methods are defined as enumerable,
|
||||
writable, configurable properties on the initialized object.
|
||||
es6id: 14.4.13
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var obj = { *method() {} };
|
||||
|
||||
verifyEnumerable(obj, 'method');
|
||||
verifyWritable(obj, 'method');
|
||||
verifyConfigurable(obj, 'method');
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Generator functions declared as methods define a `prototype` property.
|
||||
es6id: 14.4.13
|
||||
includes: [propertyHelper.js]
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var GeneratorPrototype = Object.getPrototypeOf(function* () {}).prototype;
|
||||
var method = { *method() {} }.method;
|
||||
|
||||
verifyNotEnumerable(method, 'prototype');
|
||||
verifyWritable(method, 'prototype');
|
||||
verifyNotConfigurable(method, 'prototype');
|
||||
|
||||
assert.sameValue(
|
||||
Object.getPrototypeOf(method.prototype),
|
||||
GeneratorPrototype
|
||||
);
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
The prototype of generator functions declared as methods is the
|
||||
Generator Prototype.
|
||||
es6id: 14.4.13
|
||||
features: [generators]
|
||||
---*/
|
||||
|
||||
var obj = { *method() {} };
|
||||
assert.sameValue(
|
||||
Object.getPrototypeOf(obj.method),
|
||||
Object.getPrototypeOf(function*() {})
|
||||
);
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Functions declared as methods may not be used as constructors.
|
||||
es6id: 14.3.8
|
||||
---*/
|
||||
|
||||
var obj = { method() {} };
|
||||
assert.throws(TypeError, function() {
|
||||
new obj.method();
|
||||
});
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
In the absence of the "use strict" directive, functions declared as methods
|
||||
obey "global" ThisMode semantics.
|
||||
es6id: 14.3.8
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var global = (function() { return this; }());
|
||||
var thisValue = null;
|
||||
var method = {
|
||||
method() {
|
||||
thisValue = this;
|
||||
}
|
||||
}.method;
|
||||
|
||||
method();
|
||||
|
||||
assert.sameValue(thisValue, global);
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
In the presence of the "use strict" directive, functions declared as
|
||||
methods obey "strict" ThisMode semantics.
|
||||
es6id: 14.3.8
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var thisValue = null;
|
||||
var method = {
|
||||
method() {
|
||||
'use strict';
|
||||
thisValue = this;
|
||||
}
|
||||
}.method;
|
||||
|
||||
method();
|
||||
|
||||
assert.sameValue(thisValue, undefined);
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Functions declared as methods have a `length` property that describes the
|
||||
number of formal parameters.
|
||||
es6id: 14.3.8
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var method = { method(a, b, c) {} }.method;
|
||||
|
||||
assert.sameValue(method.length, 3);
|
||||
verifyNotEnumerable(method, 'length');
|
||||
verifyNotWritable(method, 'length');
|
||||
verifyConfigurable(method, 'length');
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Functions declared as methods are assigned a `name` property according to
|
||||
the string value of their property name.
|
||||
es6id: 14.3.8
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var method = { method() {} }.method;
|
||||
|
||||
assert.sameValue(method.name, 'method');
|
||||
verifyNotEnumerable(method, 'name');
|
||||
verifyNotWritable(method, 'name');
|
||||
verifyConfigurable(method, 'name');
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Functions declared as methods are assigned a `name` property according to
|
||||
the string value of their property name.
|
||||
es6id: 14.3.8
|
||||
includes: [propertyHelper.js]
|
||||
features: [Symbol]
|
||||
---*/
|
||||
|
||||
var name = Symbol('method');
|
||||
var method = { [name]() {} }[name];
|
||||
|
||||
assert.sameValue(method.name, '[method]');
|
||||
verifyNotEnumerable(method, 'name');
|
||||
verifyNotWritable(method, 'name');
|
||||
verifyConfigurable(method, 'name');
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
The BindingIdentifier of a SingleNameBinding witihn the FormalParameters of
|
||||
a non-generator MethodDefinition may be the `yield` keyword.
|
||||
es6id: 14.3
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var obj = {
|
||||
method(yield) {
|
||||
return yield;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
assert.sameValue(obj.method('arg'), 'arg');
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
When the `yield` keyword occurs within the Initializer of a
|
||||
SingleNameBinding within the FormalParameters of a non-generator
|
||||
MethodDefinition, it behaves as an Identifier.
|
||||
es6id: 14.3
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var yield = 'default';
|
||||
var obj = {
|
||||
method(x = yield) {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
assert.sameValue(obj.method(), 'default');
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
It is a Syntax Error if any element of the BoundNames of
|
||||
StrictFormalParameters also occurs in the LexicallyDeclaredNames of
|
||||
FunctionBody.
|
||||
es6id: 14.3.1
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
var obj = {
|
||||
method(param) {
|
||||
let param;
|
||||
}
|
||||
};
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Functions declared as methods honor their declared formal parameters.
|
||||
es6id: 14.3.8
|
||||
---*/
|
||||
|
||||
var value1 = {};
|
||||
var value2 = {};
|
||||
var value3 = {};
|
||||
var arg1, arg2, arg3;
|
||||
var obj = {
|
||||
method(a, b, c) {
|
||||
arg1 = a;
|
||||
arg2 = b;
|
||||
arg3 = c;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method(value1, value2, value3);
|
||||
|
||||
assert.sameValue(arg1, value1);
|
||||
assert.sameValue(arg2, value2);
|
||||
assert.sameValue(arg3, value3);
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Errors thrown during method definition are forwarded to the runtime.
|
||||
es6id: 14.3.8
|
||||
---*/
|
||||
|
||||
assert.throws(Test262Error, function() {
|
||||
({
|
||||
[(function() { throw new Test262Error(); }())]() {}
|
||||
});
|
||||
});
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
When the `yield` keyword occurs within the PropertyName of a
|
||||
non-generator MethodDefinition within a generator function, it behaves as a
|
||||
YieldExpression.
|
||||
es6id: 14.3
|
||||
features: [generators]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var obj = null;
|
||||
var yield = 'propNameViaIdentifier';
|
||||
var iter = (function*() {
|
||||
obj = {
|
||||
[yield]() {}
|
||||
};
|
||||
})();
|
||||
|
||||
iter.next();
|
||||
|
||||
assert.sameValue(obj, null);
|
||||
|
||||
iter.next('propNameViaExpression');
|
||||
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, 'propNameViaIdentifier'), false
|
||||
);
|
||||
assert.sameValue(
|
||||
Object.hasOwnProperty.call(obj, 'propNameViaExpression'), true
|
||||
);
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
When the `yield` keyword occurs within the PropertyName of a
|
||||
non-generator MethodDefinition outside of a generator function, it behaves
|
||||
as an Identifier.
|
||||
es6id: 14.3
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var yield = 'propName';
|
||||
var obj = {
|
||||
[yield]() {}
|
||||
};
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(obj, 'propName'), true);
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Functions declared as methods are defined as enumerable, writable,
|
||||
configurable properties on the initialized object.
|
||||
es6id: 14.3.8
|
||||
includes: [propertyHelper.js]
|
||||
---*/
|
||||
|
||||
var obj = { method() {} };
|
||||
|
||||
verifyEnumerable(obj, 'method');
|
||||
verifyWritable(obj, 'method');
|
||||
verifyConfigurable(obj, 'method');
|
|
@ -0,0 +1,12 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
Functions declared as methods do not define a `prototype` property.
|
||||
es6id: 14.3.9
|
||||
---*/
|
||||
|
||||
var method = { method() {} }.method;
|
||||
|
||||
assert.sameValue(Object.hasOwnProperty.call(method, 'prototype'), false);
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
The prototype of functions declared as methods is the Function prototype.
|
||||
es6id: 14.3.8
|
||||
---*/
|
||||
|
||||
var obj = { method() {} };
|
||||
assert.sameValue(Object.getPrototypeOf(obj.method), Function.prototype);
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
|
||||
es6id: 12.2.5.1
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
({
|
||||
method() {
|
||||
super;
|
||||
}
|
||||
});
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
|
||||
es6id: 12.2.5.1
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
({
|
||||
method(param = super) {}
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
The HomeObject of Functions declared as methods is the Object prototype.
|
||||
es6id: 14.3.8
|
||||
features: [super]
|
||||
---*/
|
||||
|
||||
var value = {};
|
||||
var obj;
|
||||
|
||||
try {
|
||||
Object.prototype.Test262Attr = value;
|
||||
obj = {
|
||||
Test262Attr: null,
|
||||
method() {
|
||||
return super.Test262Attr;
|
||||
}
|
||||
};
|
||||
assert.sameValue(obj.method(), value);
|
||||
} finally {
|
||||
delete Object.prototype.Test262Attr;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: >
|
||||
The HomeObject of Functions declared as methods is the Object prototype.
|
||||
es6id: 14.3.8
|
||||
features: [super]
|
||||
---*/
|
||||
|
||||
var value = {};
|
||||
var obj;
|
||||
|
||||
try {
|
||||
Object.prototype.Test262Attr = value;
|
||||
obj = {
|
||||
Test262Attr: null,
|
||||
method(x = super.Test262Attr) {
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
assert.sameValue(obj.method(), value);
|
||||
} finally {
|
||||
delete Object.prototype.Test262Attr;
|
||||
}
|
Loading…
Reference in New Issue