Ensure functions that have prototype properties assigned by Object.defineProperty get marked as classes (#34577)

* Ensure functions that have prototype properties assigned by Object.defineProperty get marked as classes

* Revert unneeded change
This commit is contained in:
Andrew Branch
2019-10-18 16:31:43 -07:00
committed by GitHub
parent cdf1ab2dec
commit 91196fc53f
4 changed files with 67 additions and 0 deletions

View File

@@ -2788,6 +2788,10 @@ namespace ts {
function bindObjectDefinePrototypeProperty(node: BindableObjectDefinePropertyCall) {
const namespaceSymbol = lookupSymbolForPropertyAccess((node.arguments[0] as PropertyAccessExpression).expression as EntityNameExpression);
if (namespaceSymbol) {
// Ensure the namespace symbol becomes class-like
addDeclarationToSymbol(namespaceSymbol, namespaceSymbol.valueDeclaration, SymbolFlags.Class);
}
bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ true);
}