From 12c6ccb1d166870201099139a5d92472aee843f4 Mon Sep 17 00:00:00 2001 From: sanex3339 Date: Tue, 24 May 2016 21:04:44 +0300 Subject: [PATCH] dev --- .../debug-protection-nodes/DebugProtectionFunctionNode.ts | 2 +- .../unicode-array-nodes/UnicodeArrayRotateFunctionNode.js | 3 ++- .../unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts index 7c2fe8fa..0cb3436e 100644 --- a/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts +++ b/src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts @@ -30,7 +30,7 @@ export class DebugProtectionFunctionNode extends Node { */ public appendNode (blockScopeNode: BlockScopeNode): void { let programBodyLength: number = blockScopeNode.body.length, - randomIndex = Utils.getRandomInteger(0, programBodyLength); + randomIndex: number = Utils.getRandomInteger(0, programBodyLength); NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), randomIndex); } diff --git a/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.js b/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.js index 965bc7cf..7a47ee9d 100644 --- a/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.js +++ b/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.js @@ -14,7 +14,8 @@ class UnicodeArrayRotateFunctionNode extends Node_1.Node { this.node = this.getNodeStructure(); } appendNode(blockScopeNode) { - NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1); + let programBodyLength = blockScopeNode.body.length, randomIndex = Utils_1.Utils.getRandomInteger(1, programBodyLength); + NodeUtils_1.NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), randomIndex); } getNode() { if (!this.unicodeArray.length) { diff --git a/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts b/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts index 724e03dd..a19d4d90 100644 --- a/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts +++ b/src/custom-nodes/unicode-array-nodes/UnicodeArrayRotateFunctionNode.ts @@ -55,7 +55,10 @@ export class UnicodeArrayRotateFunctionNode extends Node { * @param blockScopeNode */ public appendNode (blockScopeNode: BlockScopeNode): void { - NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), 1); + let programBodyLength: number = blockScopeNode.body.length, + randomIndex: number = Utils.getRandomInteger(1, programBodyLength); + + NodeUtils.insertNodeAtIndex(blockScopeNode.body, this.getNode(), randomIndex); } /**