We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1552761 commit 86d0fa2Copy full SHA for 86d0fa2
src/compiler/utilities.ts
@@ -922,21 +922,11 @@ namespace ts {
922
}
923
924
export function getContainingFunction(node: Node): FunctionLike {
925
- while (true) {
926
- node = node.parent;
927
- if (!node || isFunctionLike(node)) {
928
- return <FunctionLike>node;
929
- }
930
+ return findAncestor(node.parent, isFunctionLike);
931
932
933
export function getContainingClass(node: Node): ClassLikeDeclaration {
934
935
936
- if (!node || isClassLike(node)) {
937
- return <ClassLikeDeclaration>node;
938
939
+ return findAncestor(node.parent, isClassLike);
940
941
942
export function getThisContainer(node: Node, includeArrowFunctions: boolean): Node {
0 commit comments