refactoring

This commit is contained in:
sanex3339
2016-05-30 22:10:11 +03:00
parent 632e02fc55
commit 27b9ae8e16
6 changed files with 17 additions and 33 deletions
+2 -10
View File
@@ -8,16 +8,8 @@ class DebugProtectionNodesGroup extends NodesGroup_1.NodesGroup {
constructor(options = {}) {
super(options);
this.debugProtectionFunctionIdentifier = Utils_1.Utils.getRandomVariableName();
this.nodes = new Map([
[
'debugProtectionFunctionNode',
new DebugProtectionFunctionNode_1.DebugProtectionFunctionNode(this.debugProtectionFunctionIdentifier)
],
[
'debugProtectionFunctionCallNode',
new DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode(this.debugProtectionFunctionIdentifier)
]
]);
this.nodes.set('debugProtectionFunctionNode', new DebugProtectionFunctionNode_1.DebugProtectionFunctionNode(this.debugProtectionFunctionIdentifier));
this.nodes.set('debugProtectionFunctionCallNode', new DebugProtectionFunctionCallNode_1.DebugProtectionFunctionCallNode(this.debugProtectionFunctionIdentifier));
if (this.options['debugProtectionInterval']) {
this.nodes.set('debugProtectionFunctionIntervalNode', new DebugProtectionFunctionIntervalNode_1.DebugProtectionFunctionIntervalNode(this.debugProtectionFunctionIdentifier));
}
+1
View File
@@ -1,6 +1,7 @@
"use strict";
class NodesGroup {
constructor(options = {}) {
this.nodes = new Map();
this.options = options;
}
getNodes() {
+1 -6
View File
@@ -11,12 +11,7 @@ class UnicodeArrayNodesGroup extends NodesGroup_1.NodesGroup {
this.unicodeArrayRotateValue = Utils_1.Utils.getRandomInteger(100, 500);
this.unicodeArrayTranslatorName = Utils_1.Utils.getRandomVariableName(UnicodeArrayNode_1.UnicodeArrayNode.UNICODE_ARRAY_RANDOM_LENGTH);
let unicodeArrayNode = new UnicodeArrayNode_1.UnicodeArrayNode(this.unicodeArrayName, this.unicodeArrayRotateValue), unicodeArray = unicodeArrayNode.getNodeData();
this.nodes = new Map([
[
'unicodeArrayNode',
unicodeArrayNode
]
]);
this.nodes.set('unicodeArrayNode', unicodeArrayNode);
if (this.options['wrapUnicodeArrayCalls']) {
this.nodes.set('unicodeArrayCallsWrapper', new UnicodeArrayCallsWrapper_1.UnicodeArrayCallsWrapper(this.unicodeArrayTranslatorName, this.unicodeArrayName, unicodeArray));
}
+8 -10
View File
@@ -20,16 +20,14 @@ export class DebugProtectionNodesGroup extends NodesGroup {
constructor (options: IOptions = {}) {
super(options);
this.nodes = new Map <string, ICustomNode> ([
[
'debugProtectionFunctionNode',
new DebugProtectionFunctionNode(this.debugProtectionFunctionIdentifier)
],
[
'debugProtectionFunctionCallNode',
new DebugProtectionFunctionCallNode(this.debugProtectionFunctionIdentifier)
]
]);
this.nodes.set(
'debugProtectionFunctionNode',
new DebugProtectionFunctionNode(this.debugProtectionFunctionIdentifier)
);
this.nodes.set(
'debugProtectionFunctionCallNode',
new DebugProtectionFunctionCallNode(this.debugProtectionFunctionIdentifier)
);
if (this.options['debugProtectionInterval']) {
this.nodes.set(
+1 -1
View File
@@ -7,7 +7,7 @@ export abstract class NodesGroup implements INodesGroup {
/**
* @type {Map<string, Node>}
*/
protected nodes: Map <string, ICustomNode>;
protected nodes: Map <string, ICustomNode> = new Map <string, ICustomNode> ();
/**
* @type {IOptions}
+4 -6
View File
@@ -35,12 +35,10 @@ export class UnicodeArrayNodesGroup extends NodesGroup {
),
unicodeArray: string [] = unicodeArrayNode.getNodeData();
this.nodes = new Map <string, ICustomNode> ([
[
'unicodeArrayNode',
unicodeArrayNode
]
]);
this.nodes.set(
'unicodeArrayNode',
unicodeArrayNode
);
if (this.options['wrapUnicodeArrayCalls']) {
this.nodes.set(