mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Protected constructors now accessible everywhere in subclasses
This commit is contained in:
1 parent
97ef839a03
commit
2169928f2b
4 files changed
+7
-13
No files matched your search
@@ -11544,18 +11544,15 @@ namespace ts {
|
||||
const declaringClassDeclaration = <ClassLikeDeclaration>getClassLikeDeclarationOfSymbol(declaration.parent.symbol);
|
||||
const declaringClass = <InterfaceType>getDeclaredTypeOfSymbol(declaration.parent.symbol);
|
||||
|
||||
// A private or protected constructor can only be instantiated within its own class or a static method of a subclass
|
||||
// A private or protected constructor can only be instantiated within its own class (or a subclass, for protected)
|
||||
if (!isNodeWithinClass(node, declaringClassDeclaration)) {
|
||||
const containingFunction = getContainingFunction(node);
|
||||
const containingClass = getContainingClass(node);
|
||||
if (containingClass) {
|
||||
const containingType = getTypeOfNode(containingClass);
|
||||
const baseTypes = getBaseTypes(<InterfaceType>containingType);
|
||||
if (baseTypes.length) {
|
||||
const baseType = baseTypes[0];
|
||||
if (containingFunction &&
|
||||
containingFunction.flags & NodeFlags.Static &&
|
||||
flags & NodeFlags.Protected &&
|
||||
if (flags & NodeFlags.Protected &&
|
||||
baseType.symbol === declaration.parent.symbol) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user