mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
check heritage clause for the presence of entry with Extends keyword (#11711)
This commit is contained in:
committed by
Mohamed Hegazy
parent
85248bb58d
commit
ff17eeda8f
@@ -795,7 +795,7 @@ namespace ts {
|
||||
function visitClassExpression(node: ClassExpression): Expression {
|
||||
const staticProperties = getInitializedProperties(node, /*isStatic*/ true);
|
||||
const heritageClauses = visitNodes(node.heritageClauses, visitor, isHeritageClause);
|
||||
const members = transformClassMembers(node, heritageClauses !== undefined);
|
||||
const members = transformClassMembers(node, some(heritageClauses, c => c.token === SyntaxKind.ExtendsKeyword));
|
||||
|
||||
const classExpression = setOriginalNode(
|
||||
createClassExpression(
|
||||
|
||||
20
tests/baselines/reference/classExpressions.js
Normal file
20
tests/baselines/reference/classExpressions.js
Normal file
@@ -0,0 +1,20 @@
|
||||
//// [classExpressions.ts]
|
||||
interface A {}
|
||||
let x = class B implements A {
|
||||
prop: number;
|
||||
onStart(): void {
|
||||
}
|
||||
func = () => {
|
||||
}
|
||||
};
|
||||
|
||||
//// [classExpressions.js]
|
||||
var x = (function () {
|
||||
function B() {
|
||||
this.func = function () {
|
||||
};
|
||||
}
|
||||
B.prototype.onStart = function () {
|
||||
};
|
||||
return B;
|
||||
}());
|
||||
19
tests/baselines/reference/classExpressions.symbols
Normal file
19
tests/baselines/reference/classExpressions.symbols
Normal file
@@ -0,0 +1,19 @@
|
||||
=== tests/cases/compiler/classExpressions.ts ===
|
||||
interface A {}
|
||||
>A : Symbol(A, Decl(classExpressions.ts, 0, 0))
|
||||
|
||||
let x = class B implements A {
|
||||
>x : Symbol(x, Decl(classExpressions.ts, 1, 3))
|
||||
>B : Symbol(B, Decl(classExpressions.ts, 1, 7))
|
||||
>A : Symbol(A, Decl(classExpressions.ts, 0, 0))
|
||||
|
||||
prop: number;
|
||||
>prop : Symbol(B.prop, Decl(classExpressions.ts, 1, 30))
|
||||
|
||||
onStart(): void {
|
||||
>onStart : Symbol(B.onStart, Decl(classExpressions.ts, 2, 17))
|
||||
}
|
||||
func = () => {
|
||||
>func : Symbol(B.func, Decl(classExpressions.ts, 4, 5))
|
||||
}
|
||||
};
|
||||
21
tests/baselines/reference/classExpressions.types
Normal file
21
tests/baselines/reference/classExpressions.types
Normal file
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/classExpressions.ts ===
|
||||
interface A {}
|
||||
>A : A
|
||||
|
||||
let x = class B implements A {
|
||||
>x : typeof B
|
||||
>class B implements A { prop: number; onStart(): void { } func = () => { }} : typeof B
|
||||
>B : typeof B
|
||||
>A : A
|
||||
|
||||
prop: number;
|
||||
>prop : number
|
||||
|
||||
onStart(): void {
|
||||
>onStart : () => void
|
||||
}
|
||||
func = () => {
|
||||
>func : () => void
|
||||
>() => { } : () => void
|
||||
}
|
||||
};
|
||||
8
tests/cases/compiler/classExpressions.ts
Normal file
8
tests/cases/compiler/classExpressions.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
interface A {}
|
||||
let x = class B implements A {
|
||||
prop: number;
|
||||
onStart(): void {
|
||||
}
|
||||
func = () => {
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user