-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding test case for super access from class field defined as arrow f…
…unction
- Loading branch information
Showing
3 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/class-elements/super-access-from-arrow-func-on-field.case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (C) 2021 Caio Lima (Igalia SL). All rights reserved. | ||
// This code is governed by the BSD license found in the LICENSE file. | ||
|
||
/*--- | ||
desc: super inside arrow functions on field initializer resolves to class' super | ||
info: | | ||
ClassElementName : | ||
PropertyName | ||
PrivateName | ||
|
||
SuperProperty: | ||
super[Expression] | ||
super.IdentifierName | ||
|
||
template: default | ||
features: [class-fields-public, class-static-fields-public] | ||
---*/ | ||
|
||
//- elements | ||
func = () => { | ||
super.prop = 'test262'; | ||
} | ||
|
||
static staticFunc = () => { | ||
super.staticProp = 'static test262'; | ||
} | ||
//- assertions | ||
|
||
let c = new C(); | ||
c.func(); | ||
assert.sameValue(c.prop, 'test262'); | ||
|
||
C.staticFunc(); | ||
assert.sameValue(C.staticProp, 'static test262'); | ||
|
37 changes: 37 additions & 0 deletions
37
test/language/expressions/class/elements/super-access-from-arrow-func-on-field.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// This file was procedurally generated from the following sources: | ||
// - src/class-elements/super-access-from-arrow-func-on-field.case | ||
// - src/class-elements/default/cls-expr.template | ||
/*--- | ||
description: super inside arrow functions on field initializer resolves to class' super (field definitions in a class expression) | ||
esid: prod-FieldDefinition | ||
features: [class-fields-public, class-static-fields-public, class] | ||
flags: [generated] | ||
info: | | ||
ClassElementName : | ||
PropertyName | ||
PrivateName | ||
SuperProperty: | ||
super[Expression] | ||
super.IdentifierName | ||
---*/ | ||
|
||
|
||
var C = class { | ||
func = () => { | ||
super.prop = 'test262'; | ||
} | ||
|
||
static staticFunc = () => { | ||
super.staticProp = 'static test262'; | ||
} | ||
} | ||
|
||
let c = new C(); | ||
c.func(); | ||
assert.sameValue(c.prop, 'test262'); | ||
|
||
C.staticFunc(); | ||
assert.sameValue(C.staticProp, 'static test262'); | ||
|
37 changes: 37 additions & 0 deletions
37
test/language/statements/class/elements/super-access-from-arrow-func-on-field.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// This file was procedurally generated from the following sources: | ||
// - src/class-elements/super-access-from-arrow-func-on-field.case | ||
// - src/class-elements/default/cls-decl.template | ||
/*--- | ||
description: super inside arrow functions on field initializer resolves to class' super (field definitions in a class declaration) | ||
esid: prod-FieldDefinition | ||
features: [class-fields-public, class-static-fields-public, class] | ||
flags: [generated] | ||
info: | | ||
ClassElementName : | ||
PropertyName | ||
PrivateName | ||
SuperProperty: | ||
super[Expression] | ||
super.IdentifierName | ||
---*/ | ||
|
||
|
||
class C { | ||
func = () => { | ||
super.prop = 'test262'; | ||
} | ||
|
||
static staticFunc = () => { | ||
super.staticProp = 'static test262'; | ||
} | ||
} | ||
|
||
let c = new C(); | ||
c.func(); | ||
assert.sameValue(c.prop, 'test262'); | ||
|
||
C.staticFunc(); | ||
assert.sameValue(C.staticProp, 'static test262'); | ||
|