demo/typescript.js
function getEnclosingBlockScopeContainer(node) {
        var current = node.parent;
        while (current) {
            if (isFunctionLike(current)) {
                return current;
            }
            switch (current.kind) {
                case 248 /* SourceFile */:
                case 220 /* CaseBlock */:
                case 244 /* CatchClause */:
                case 218 /* ModuleDeclaration */:
                case 199 /* ForStatement */:
                case 200 /* ForInStatement */:
                case 201 /* ForOfStatement */:
                    return current;
                case 192 /* Block */:
                    // function block is not considered block-scope container
                    // see comment in binder.ts: bind(...), case for SyntaxKind.Block
                    if (!isFunctionLike(current.parent)) {
                        return current;
                    }
            }
            current = current.parent;
        }
    }
function getEnclosingBlockScopeContainer(node) {
        var current = node.parent;
        while (current) {
            if (isFunctionLike(current)) {
                return current;
            }
            switch (current.kind) {
                case 248 /* SourceFile */:
                case 220 /* CaseBlock */:
                case 244 /* CatchClause */:
                case 218 /* ModuleDeclaration */:
                case 199 /* ForStatement */:
                case 200 /* ForInStatement */:
                case 201 /* ForOfStatement */:
                    return current;
                case 192 /* Block */:
                    // function block is not considered block-scope container
                    // see comment in binder.ts: bind(...), case for SyntaxKind.Block
                    if (!isFunctionLike(current.parent)) {
                        return current;
                    }
            }
            current = current.parent;
        }
    }
Gets the nearest enclosing block scope container that has the provided node as a descendant, that is not the provided node.