replaced let on const, added readonly keywords

This commit is contained in:
sanex3339
2016-11-24 00:34:34 +03:00
parent e31006193a
commit e8fcbdf315
28 changed files with 120 additions and 127 deletions
+4 -4
View File
@@ -15,7 +15,7 @@ export class NodeUtils {
/**
* @type {string[]}
*/
private static nodesWithBlockScope: string[] = [
private static readonly nodesWithBlockScope: string[] = [
NodeType.ArrowFunctionExpression,
NodeType.FunctionDeclaration,
NodeType.FunctionExpression,
@@ -42,7 +42,7 @@ export class NodeUtils {
* @returns {TStatement[]}
*/
public static convertCodeToStructure (code: string): TStatement[] {
let structure: ESTree.Program = esprima.parse(code);
const structure: ESTree.Program = esprima.parse(code);
NodeUtils.addXVerbatimPropertyToLiterals(structure);
NodeUtils.parentize(structure);
@@ -73,7 +73,7 @@ export class NodeUtils {
* @returns {ESTree.Node}
*/
public static getBlockScopeOfNode (node: ESTree.Node, depth: number = 0): TNodeWithBlockStatement {
let parentNode: ESTree.Node | undefined = node.parentNode;
const parentNode: ESTree.Node | undefined = node.parentNode;
if (!parentNode) {
throw new ReferenceError('`parentNode` property of given node is `undefined`');
@@ -106,7 +106,7 @@ export class NodeUtils {
* @returns {number}
*/
public static getNodeBlockScopeDepth (node: ESTree.Node, depth: number = 0): number {
let parentNode: ESTree.Node | undefined = node.parentNode;
const parentNode: ESTree.Node | undefined = node.parentNode;
if (!parentNode) {
throw new ReferenceError('`parentNode` property of given node is `undefined`');