MCPcopy Create free account
hub / github.com/nodejs/node / trySubstituteClassAlias

Function trySubstituteClassAlias

test/fixtures/snapshot/typescript.js:94181–94202  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

94179 || node;
94180 }
94181 function trySubstituteClassAlias(node) {
94182 if (enabledSubstitutions & 1 /* TypeScriptSubstitutionFlags.ClassAliases */) {
94183 if (resolver.getNodeCheckFlags(node) & 33554432 /* NodeCheckFlags.ConstructorReferenceInClass */) {
94184 // Due to the emit for class decorators, any reference to the class from inside of the class body
94185 // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
94186 // behavior of class names in ES6.
94187 // Also, when emitting statics for class expressions, we must substitute a class alias for
94188 // constructor references in static property initializers.
94189 var declaration = resolver.getReferencedValueDeclaration(node);
94190 if (declaration) {
94191 var classAlias = classAliases[declaration.id]; // TODO: GH#18217
94192 if (classAlias) {
94193 var clone_2 = factory.cloneNode(classAlias);
94194 ts.setSourceMapRange(clone_2, node);
94195 ts.setCommentRange(clone_2, node);
94196 return clone_2;
94197 }
94198 }
94199 }
94200 }
94201 return undefined;
94202 }
94203 function trySubstituteNamespaceExportedName(node) {
94204 // If this is explicitly a local name, do not substitute.
94205 if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected