Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
test262
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pmaksimo
test262
Commits
2acbd3e9
Commit
2acbd3e9
authored
9 years ago
by
André Bargull
Browse files
Options
Downloads
Patches
Plain Diff
Improve coverage for default class constructors
parent
c46f5ff4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/language/statements/class/subclass/default-constructor-spread-override.js
+57
-0
57 additions, 0 deletions
...nts/class/subclass/default-constructor-spread-override.js
with
57 additions
and
0 deletions
test/language/statements/class/subclass/default-constructor-spread-override.js
0 → 100755
+
57
−
0
View file @
2acbd3e9
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-runtime-semantics-classdefinitionevaluation
description: >
Default class constructor uses standard iterator spread semantics.
info: >
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
...
10. If constructor is empty, then
a. If ClassHeritageopt is present, then
i Let constructor be the result of parsing the source text
constructor(...args){ super(...args); }
using the syntactic grammar with the goal symbol MethodDefinition.
...
14.1.19 Runtime Semantics: IteratorBindingInitialization
`FunctionRestParameter : BindingRestElement`
...
9. Let result be the result of performing IteratorBindingInitialization for BindingRestElement using iteratorRecord and environment as the arguments.
...
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
`BindingRestElement : ...BindingIdentifier`
...
2. Let A be ArrayCreate(0).
...
12.3.6.1 Runtime Semantics: ArgumentListEvaluation
`ArgumentList : ArgumentList , ...AssignmentExpression`
...
3. Let iterator be ? GetIterator(? GetValue(spreadRef)).
...
features: [Symbol.iterator]
---*/
var
arrayIterator
=
Array
.
prototype
[
Symbol
.
iterator
];
// Redefine Array iterator to change the result of spreading `args` in `super(...args)`.
Array
.
prototype
[
Symbol
.
iterator
]
=
function
()
{
return
arrayIterator
.
call
([
"
spread-value
"
]);
};
var
receivedValue
;
class
Base
{
constructor
(
value
)
{
receivedValue
=
value
;
}
}
class
Derived
extends
Base
{}
new
Derived
();
assert
.
sameValue
(
receivedValue
,
"
spread-value
"
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment