fix code processing no if

This commit is contained in:
Silver Kuusik 2018-08-15 20:44:52 +02:00
parent 342d07ee58
commit c588d70009

View File

@ -116,7 +116,7 @@ window.addEventListener('load', function() {
var lines = [];
var foundTrue = false;
// Function to process code and highlight blocks and lines
function processCode(index, highlight) {
function processCode(index) {
// When all lines are already processed
if (lines.length == 0) return;
// Split into code and block ID
@ -142,7 +142,7 @@ window.addEventListener('load', function() {
}
}
// Some lines don't correspond to any block
if (temp[1] && index != -1 && ((!isCondition && foundTrue) || isCondition)) {
if (temp[1] && index != -1 && ((!isCondition && foundTrue) || isCondition || !/if/.test(lines[0]))) {
// When sleep function, we get the timeout value from the function
if (/\d/.test(code)) {
timeout = parseInt(code.replace(/[a-z\.()]/g, ''));