mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
move static flag predicate before get container
This commit is contained in:
parent
56d042468f
commit
ee310a42f0
@ -17110,8 +17110,7 @@ namespace ts {
|
||||
// allow PropertyAccessibility if context is in function with this parameter
|
||||
// static member access is disallow
|
||||
let thisParameter: ParameterDeclaration | undefined;
|
||||
const thisContainer = getThisContainer(node, /* includeArrowFunctions */ false);
|
||||
if (flags & ModifierFlags.Static || !thisContainer || !isFunctionLike(thisContainer) || !(thisParameter = getThisParameter(thisContainer)) || !thisParameter.type) {
|
||||
if (flags & ModifierFlags.Static || !(thisParameter = getThisParameterFromNodeContext(node)) || !thisParameter.type) {
|
||||
error(errorNode, Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(getDeclaringClass(prop) || type));
|
||||
return false;
|
||||
}
|
||||
@ -17134,6 +17133,11 @@ namespace ts {
|
||||
return true;
|
||||
}
|
||||
|
||||
function getThisParameterFromNodeContext (node: Node) {
|
||||
const thisContainer = getThisContainer(node, /* includeArrowFunctions */ false);
|
||||
return thisContainer && isFunctionLike(thisContainer) ? getThisParameter(thisContainer) : undefined;
|
||||
}
|
||||
|
||||
function symbolHasNonMethodDeclaration(symbol: Symbol) {
|
||||
return forEachProperty(symbol, prop => {
|
||||
const propKind = getDeclarationKindFromSymbol(prop);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user