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
49039979
Commit
49039979
authored
6 years ago
by
Kevin Gibbons
Browse files
Options
Downloads
Patches
Plain Diff
Add test for double super for proposal-class-fields#92
parent
dba8d7cd
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/expressions/class/fields-run-once-on-double-super.js
+41
-0
41 additions, 0 deletions
...uage/expressions/class/fields-run-once-on-double-super.js
with
41 additions
and
0 deletions
test/language/expressions/class/fields-run-once-on-double-super.js
0 → 100644
+
41
−
0
View file @
49039979
// Copyright (C) 2018 Kevin Gibbons. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-super-keyword-runtime-semantics-evaluation
description: >
when calling `super()` for a second time in a derived class, the super constructor is run twice but the field initializers are only run once
info: |
[...]
6. Let result be ? Construct(func, argList, newTarget).
[...]
10. Perform ? thisER.BindThisValue(result).
11. Perform ? InitializeInstanceFields(result, F).
[...]
features: [class-fields-public]
---*/
var
baseCtorCalled
=
0
;
var
fieldInitCalled
=
0
;
class
Base
{
constructor
()
{
++
baseCtorCalled
;
}
}
var
C
=
class
extends
Base
{
field
=
++
fieldInitCalled
;
constructor
()
{
assert
.
sameValue
(
baseCtorCalled
,
0
);
assert
.
sameValue
(
fieldInitCalled
,
0
);
super
();
assert
.
sameValue
(
baseCtorCalled
,
1
);
assert
.
sameValue
(
fieldInitCalled
,
1
);
assert
.
throws
(
ReferenceError
,
()
=>
super
());
}
};
new
C
();
assert
.
sameValue
(
baseCtorCalled
,
2
);
assert
.
sameValue
(
fieldInitCalled
,
1
);
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