refactoring

This commit is contained in:
sanex3339
2016-05-23 18:41:48 +03:00
parent 5605fa274c
commit c6961d6417
2 changed files with 4 additions and 12 deletions
+1 -4
View File
@@ -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;
+3 -8
View File
@@ -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');
}
/**