mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 07:29:16 -05:00
Add a flag so we don't repeatedly finding super call
This commit is contained in:
@@ -7284,8 +7284,11 @@ namespace ts {
|
||||
*/
|
||||
function getSuperCallInConstructor(constructor: ConstructorDeclaration): ExpressionStatement {
|
||||
const links = getNodeLinks(constructor);
|
||||
if (!links.superCall) {
|
||||
|
||||
// Only trying to find super-call if we haven't yet tried to find one. Once we try, we will record the result
|
||||
if (links.hasSuperCall === undefined) {
|
||||
links.superCall = <ExpressionStatement>findFirstSuperCall(constructor.body);
|
||||
links.hasSuperCall = links.superCall ? true : false;
|
||||
}
|
||||
return links.superCall;
|
||||
}
|
||||
|
||||
@@ -459,7 +459,6 @@ namespace ts {
|
||||
IntrinsicElement = IntrinsicNamedElement | IntrinsicIndexedElement,
|
||||
}
|
||||
|
||||
|
||||
/* @internal */
|
||||
export const enum RelationComparisonResult {
|
||||
Succeeded = 1, // Should be truthy
|
||||
@@ -2088,6 +2087,7 @@ namespace ts {
|
||||
importOnRightSide?: Symbol; // for import declarations - import that appear on the right side
|
||||
jsxFlags?: JsxFlags; // flags for knowning what kind of element/attributes we're dealing with
|
||||
resolvedJsxType?: Type; // resolved element attributes type of a JSX openinglike element
|
||||
hasSuperCall?: boolean; // recorded result when we try to find super-call. We only try to find one if this flag is undefined, indicating that we haven't made an attempt.
|
||||
superCall?: ExpressionStatement; // Cached first super-call found in the constructor. Used in checking whether super is called before this-accessing
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user