mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
187 lines
3.6 KiB
TypeScript
187 lines
3.6 KiB
TypeScript
//// [tests/cases/conformance/classes/constructorDeclarations/superCalls/derivedClassSuperStatementPosition.ts] ////
|
|
|
|
//// [derivedClassSuperStatementPosition.ts]
|
|
class DerivedBasic extends Object {
|
|
prop = 1;
|
|
constructor() {
|
|
super();
|
|
}
|
|
}
|
|
|
|
class DerivedAfterParameterDefault extends Object {
|
|
x1: boolean;
|
|
x2: boolean;
|
|
constructor(x = false) {
|
|
this.x1 = x;
|
|
super(x);
|
|
this.x2 = x;
|
|
}
|
|
}
|
|
|
|
class DerivedAfterRestParameter extends Object {
|
|
x1: boolean[];
|
|
x2: boolean[];
|
|
constructor(...x: boolean[]) {
|
|
this.x1 = x;
|
|
super(x);
|
|
this.x2 = x;
|
|
}
|
|
}
|
|
|
|
class DerivedComments extends Object {
|
|
x: any;
|
|
constructor() {
|
|
// c1
|
|
console.log(); // c2
|
|
// c3
|
|
super(); // c4
|
|
// c5
|
|
this.x = null; // c6
|
|
// c7
|
|
}
|
|
}
|
|
|
|
class DerivedCommentsInvalidThis extends Object {
|
|
x: any;
|
|
constructor() {
|
|
// c0
|
|
this;
|
|
// c1
|
|
console.log(); // c2
|
|
// c3
|
|
super(); // c4
|
|
// c5
|
|
this.x = null; // c6
|
|
// c7
|
|
}
|
|
}
|
|
|
|
class DerivedInConditional extends Object {
|
|
prop = 1;
|
|
constructor() {
|
|
Math.random()
|
|
? super(1)
|
|
: super(0);
|
|
}
|
|
}
|
|
|
|
class DerivedInIf extends Object {
|
|
prop = 1;
|
|
constructor() {
|
|
if (Math.random()) {
|
|
super(1);
|
|
}
|
|
else {
|
|
super(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
class DerivedInBlockWithProperties extends Object {
|
|
prop = 1;
|
|
constructor(private paramProp = 2) {
|
|
{
|
|
super();
|
|
}
|
|
}
|
|
}
|
|
|
|
class DerivedInConditionalWithProperties extends Object {
|
|
prop = 1;
|
|
constructor(private paramProp = 2) {
|
|
if (Math.random()) {
|
|
super(1);
|
|
} else {
|
|
super(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
//// [derivedClassSuperStatementPosition.js]
|
|
"use strict";
|
|
class DerivedBasic extends Object {
|
|
constructor() {
|
|
super();
|
|
this.prop = 1;
|
|
}
|
|
}
|
|
class DerivedAfterParameterDefault extends Object {
|
|
constructor(x = false) {
|
|
this.x1 = x;
|
|
super(x);
|
|
this.x2 = x;
|
|
}
|
|
}
|
|
class DerivedAfterRestParameter extends Object {
|
|
constructor(...x) {
|
|
this.x1 = x;
|
|
super(x);
|
|
this.x2 = x;
|
|
}
|
|
}
|
|
class DerivedComments extends Object {
|
|
constructor() {
|
|
// c1
|
|
console.log(); // c2
|
|
// c3
|
|
super(); // c4
|
|
// c5
|
|
this.x = null; // c6
|
|
// c7
|
|
}
|
|
}
|
|
class DerivedCommentsInvalidThis extends Object {
|
|
constructor() {
|
|
// c0
|
|
this;
|
|
// c1
|
|
console.log(); // c2
|
|
// c3
|
|
super(); // c4
|
|
// c5
|
|
this.x = null; // c6
|
|
// c7
|
|
}
|
|
}
|
|
class DerivedInConditional extends Object {
|
|
constructor() {
|
|
this.prop = 1;
|
|
Math.random()
|
|
? super(1)
|
|
: super(0);
|
|
}
|
|
}
|
|
class DerivedInIf extends Object {
|
|
constructor() {
|
|
this.prop = 1;
|
|
if (Math.random()) {
|
|
super(1);
|
|
}
|
|
else {
|
|
super(0);
|
|
}
|
|
}
|
|
}
|
|
class DerivedInBlockWithProperties extends Object {
|
|
constructor(paramProp = 2) {
|
|
this.paramProp = paramProp;
|
|
this.prop = 1;
|
|
{
|
|
super();
|
|
}
|
|
}
|
|
}
|
|
class DerivedInConditionalWithProperties extends Object {
|
|
constructor(paramProp = 2) {
|
|
this.paramProp = paramProp;
|
|
this.prop = 1;
|
|
if (Math.random()) {
|
|
super(1);
|
|
}
|
|
else {
|
|
super(0);
|
|
}
|
|
}
|
|
}
|