(declaration, modifierFlag)
| 135716 | return ts.mapDefined(getNodesToSearchForModifier(declaration, ts.modifierToFlag(modifier)), function (node) { return ts.findModifier(node, modifier); }); |
| 135717 | } |
| 135718 | function getNodesToSearchForModifier(declaration, modifierFlag) { |
| 135719 | // Types of node whose children might have modifiers. |
| 135720 | var container = declaration.parent; |
| 135721 | switch (container.kind) { |
| 135722 | case 262 /* SyntaxKind.ModuleBlock */: |
| 135723 | case 305 /* SyntaxKind.SourceFile */: |
| 135724 | case 235 /* SyntaxKind.Block */: |
| 135725 | case 289 /* SyntaxKind.CaseClause */: |
| 135726 | case 290 /* SyntaxKind.DefaultClause */: |
| 135727 | // Container is either a class declaration or the declaration is a classDeclaration |
| 135728 | if (modifierFlag & 128 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { |
| 135729 | return __spreadArray(__spreadArray([], declaration.members, true), [declaration], false); |
| 135730 | } |
| 135731 | else { |
| 135732 | return container.statements; |
| 135733 | } |
| 135734 | case 171 /* SyntaxKind.Constructor */: |
| 135735 | case 169 /* SyntaxKind.MethodDeclaration */: |
| 135736 | case 256 /* SyntaxKind.FunctionDeclaration */: |
| 135737 | return __spreadArray(__spreadArray([], container.parameters, true), (ts.isClassLike(container.parent) ? container.parent.members : []), true); |
| 135738 | case 257 /* SyntaxKind.ClassDeclaration */: |
| 135739 | case 226 /* SyntaxKind.ClassExpression */: |
| 135740 | case 258 /* SyntaxKind.InterfaceDeclaration */: |
| 135741 | case 182 /* SyntaxKind.TypeLiteral */: |
| 135742 | var nodes = container.members; |
| 135743 | // If we're an accessibility modifier, we're in an instance member and should search |
| 135744 | // the constructor's parameter list for instance members as well. |
| 135745 | if (modifierFlag & (28 /* ModifierFlags.AccessibilityModifier */ | 64 /* ModifierFlags.Readonly */)) { |
| 135746 | var constructor = ts.find(container.members, ts.isConstructorDeclaration); |
| 135747 | if (constructor) { |
| 135748 | return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true); |
| 135749 | } |
| 135750 | } |
| 135751 | else if (modifierFlag & 128 /* ModifierFlags.Abstract */) { |
| 135752 | return __spreadArray(__spreadArray([], nodes, true), [container], false); |
| 135753 | } |
| 135754 | return nodes; |
| 135755 | // Syntactically invalid positions that the parser might produce anyway |
| 135756 | case 205 /* SyntaxKind.ObjectLiteralExpression */: |
| 135757 | return undefined; |
| 135758 | default: |
| 135759 | ts.Debug.assertNever(container, "Invalid container kind."); |
| 135760 | } |
| 135761 | } |
| 135762 | function pushKeywordIf(keywordList, token) { |
| 135763 | var expected = []; |
| 135764 | for (var _i = 2; _i < arguments.length; _i++) { |
no test coverage detected