* Adds the constructor of the class to a class body function. * * @param statements The statements of the class body function. * @param node The ClassExpression or ClassDeclaration node. * @param extendsClauseElement The expression for the class `extends` clause.
(statements, node, name, extendsClauseElement)
| 99059 | * @param extendsClauseElement The expression for the class `extends` clause. |
| 99060 | */ |
| 99061 | function addConstructor(statements, node, name, extendsClauseElement) { |
| 99062 | var savedConvertedLoopState = convertedLoopState; |
| 99063 | convertedLoopState = undefined; |
| 99064 | var ancestorFacts = enterSubtree(32662 /* HierarchyFacts.ConstructorExcludes */, 73 /* HierarchyFacts.ConstructorIncludes */); |
| 99065 | var constructor = ts.getFirstConstructorWithBody(node); |
| 99066 | var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined); |
| 99067 | var constructorFunction = factory.createFunctionDeclaration( |
| 99068 | /*decorators*/ undefined, |
| 99069 | /*modifiers*/ undefined, |
| 99070 | /*asteriskToken*/ undefined, name, |
| 99071 | /*typeParameters*/ undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), |
| 99072 | /*type*/ undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper)); |
| 99073 | ts.setTextRange(constructorFunction, constructor || node); |
| 99074 | if (extendsClauseElement) { |
| 99075 | ts.setEmitFlags(constructorFunction, 8 /* EmitFlags.CapturesThis */); |
| 99076 | } |
| 99077 | statements.push(constructorFunction); |
| 99078 | exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); |
| 99079 | convertedLoopState = savedConvertedLoopState; |
| 99080 | } |
| 99081 | /** |
| 99082 | * Transforms the parameters of the constructor declaration of a class. |
| 99083 | * |
no test coverage detected
searching dependent graphs…