(changeTracker, sourceFile, classDeclaration, token, makeStatic)
| 154846 | return codefix.createCodeFixAction(fixMissingMember, changes, [diagnostic, token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members); |
| 154847 | } |
| 154848 | function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { |
| 154849 | var tokenName = token.text; |
| 154850 | if (makeStatic) { |
| 154851 | if (classDeclaration.kind === 226 /* SyntaxKind.ClassExpression */) { |
| 154852 | return; |
| 154853 | } |
| 154854 | var className = classDeclaration.name.getText(); |
| 154855 | var staticInitialization = initializePropertyToUndefined(ts.factory.createIdentifier(className), tokenName); |
| 154856 | changeTracker.insertNodeAfter(sourceFile, classDeclaration, staticInitialization); |
| 154857 | } |
| 154858 | else if (ts.isPrivateIdentifier(token)) { |
| 154859 | var property = ts.factory.createPropertyDeclaration( |
| 154860 | /*decorators*/ undefined, |
| 154861 | /*modifiers*/ undefined, tokenName, |
| 154862 | /*questionToken*/ undefined, |
| 154863 | /*type*/ undefined, |
| 154864 | /*initializer*/ undefined); |
| 154865 | var lastProp = getNodeToInsertPropertyAfter(classDeclaration); |
| 154866 | if (lastProp) { |
| 154867 | changeTracker.insertNodeAfter(sourceFile, lastProp, property); |
| 154868 | } |
| 154869 | else { |
| 154870 | changeTracker.insertMemberAtStart(sourceFile, classDeclaration, property); |
| 154871 | } |
| 154872 | } |
| 154873 | else { |
| 154874 | var classConstructor = ts.getFirstConstructorWithBody(classDeclaration); |
| 154875 | if (!classConstructor) { |
| 154876 | return; |
| 154877 | } |
| 154878 | var propertyInitialization = initializePropertyToUndefined(ts.factory.createThis(), tokenName); |
| 154879 | changeTracker.insertNodeAtConstructorEnd(sourceFile, classConstructor, propertyInitialization); |
| 154880 | } |
| 154881 | } |
| 154882 | function initializePropertyToUndefined(obj, propertyName) { |
| 154883 | return ts.factory.createExpressionStatement(ts.factory.createAssignment(ts.factory.createPropertyAccessExpression(obj, propertyName), createUndefined())); |
| 154884 | } |
no test coverage detected