diff --git a/src/NodeUtils.js b/src/NodeUtils.js index 1e008801..25aa4ad8 100644 --- a/src/NodeUtils.js +++ b/src/NodeUtils.js @@ -48,10 +48,7 @@ class NodeUtils { return node.type === NodeType_1.NodeType.MemberExpression; } static isNodeHasBlockScope(node) { - return (node.type === NodeType_1.NodeType.BlockStatement || - node.type === NodeType_1.NodeType.CatchClause || - node.type === NodeType_1.NodeType.FunctionExpression || - node.type === NodeType_1.NodeType.Program) && node.hasOwnProperty('body'); + return node.hasOwnProperty('body'); } static isProgramNode(node) { return node.type === NodeType_1.NodeType.Program; diff --git a/src/NodeUtils.ts b/src/NodeUtils.ts index 78af6d7d..56901875 100644 --- a/src/NodeUtils.ts +++ b/src/NodeUtils.ts @@ -1,4 +1,6 @@ import { IBlockStatementNode } from "./interfaces/nodes/IBlockStatementNode"; +import { ICatchClauseNode } from "./interfaces/nodes/ICatchClauseNode"; +import { IFunctionNode } from "./interfaces/nodes/IFunctionNode"; import { IIdentifierNode } from "./interfaces/nodes/IIdentifierNode"; import { ILiteralNode } from "./interfaces/nodes/ILiteralNode"; import { IMemberExpressionNode } from "./interfaces/nodes/IMemberExpressionNode"; @@ -10,8 +12,6 @@ import { IVariableDeclaratorNode } from "./interfaces/nodes/IVariableDeclaratorN import { NodeType } from "./enums/NodeType"; import { Utils } from "./Utils"; -import {ICatchClauseNode} from "./interfaces/nodes/ICatchClauseNode"; -import {IFunctionNode} from "./interfaces/nodes/IFunctionNode"; export class NodeUtils { /** @@ -129,12 +129,7 @@ export class NodeUtils { public static isNodeHasBlockScope ( node: ITreeNode ): node is IBlockStatementNode|ICatchClauseNode|IFunctionNode|IProgramNode { - return ( - node.type === NodeType.BlockStatement || - node.type === NodeType.CatchClause || - node.type === NodeType.FunctionExpression || - node.type === NodeType.Program - ) && node.hasOwnProperty('body'); + return node.hasOwnProperty('body'); } /**