fix warnings
This commit is contained in:
parent
bbd14c58b5
commit
6a4de9c7a2
@ -331,7 +331,7 @@ Blockly.Blocks['switch_case'] = {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw 'Unknown block type.';
|
throw new Error('Unknown block type.');
|
||||||
}
|
}
|
||||||
caseBlock = caseBlock.nextConnection &&
|
caseBlock = caseBlock.nextConnection &&
|
||||||
caseBlock.nextConnection.targetBlock();
|
caseBlock.nextConnection.targetBlock();
|
||||||
@ -355,7 +355,7 @@ Blockly.Blocks['switch_case'] = {
|
|||||||
caseBlock.satementConnection_ = defaultInput && defaultInput.connection.targetConnection;
|
caseBlock.satementConnection_ = defaultInput && defaultInput.connection.targetConnection;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw 'Unknown block type';
|
throw new Error('Unknown block type');
|
||||||
}
|
}
|
||||||
caseBlock = caseBlock.nextConnection &&
|
caseBlock = caseBlock.nextConnection &&
|
||||||
caseBlock.nextConnection.targetBlock();
|
caseBlock.nextConnection.targetBlock();
|
||||||
|
@ -64,7 +64,7 @@ Blockly.Blocks['sensebox_sd_write_file'] = {
|
|||||||
// Is the block nested in a loop?
|
// Is the block nested in a loop?
|
||||||
var block = this;
|
var block = this;
|
||||||
do {
|
do {
|
||||||
if (this.LOOP_TYPES.indexOf(block.type) != -1) {
|
if (this.LOOP_TYPES.indexOf(block.type) !== -1) {
|
||||||
legal = true;
|
legal = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -139,13 +139,13 @@ Blockly.Arduino['switch_case'] = function (block) {
|
|||||||
var default_code = '';
|
var default_code = '';
|
||||||
var DO = Blockly.Arduino.statementToCode(block, ('CASE' + n));
|
var DO = Blockly.Arduino.statementToCode(block, ('CASE' + n));
|
||||||
for (n = 0; n <= block.caseCount_; n++) {
|
for (n = 0; n <= block.caseCount_; n++) {
|
||||||
var DO = Blockly.Arduino.statementToCode(block, ('CASE' + n));
|
DO = Blockly.Arduino.statementToCode(block, ('CASE' + n));
|
||||||
var branch = Blockly.Arduino.valueToCode(block, ('CASECONDITION' + n), Blockly.Arduino.ORDER_NONE) || '0';
|
branch = Blockly.Arduino.valueToCode(block, ('CASECONDITION' + n), Blockly.Arduino.ORDER_NONE) || '0';
|
||||||
cases += 'case ' + branch + ':\n';
|
cases += 'case ' + branch + ':\n';
|
||||||
cases += DO + '\nbreak;\n';
|
cases += DO + '\nbreak;\n';
|
||||||
}
|
}
|
||||||
if (block.defaultCount_) {
|
if (block.defaultCount_) {
|
||||||
var branch = Blockly.Arduino.statementToCode(block, 'ONDEFAULT');
|
branch = Blockly.Arduino.statementToCode(block, 'ONDEFAULT');
|
||||||
default_code = 'default: \n' + branch + '\n break;\n';
|
default_code = 'default: \n' + branch + '\n break;\n';
|
||||||
}
|
}
|
||||||
var code = 'switch (' + argument + ') {\n' + cases + default_code + '}';
|
var code = 'switch (' + argument + ') {\n' + cases + default_code + '}';
|
||||||
|
@ -32,22 +32,23 @@ Blockly.Arduino.sensebox_sd_open_file = function (block) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Blockly.Arduino.sensebox_sd_write_file = function (block) {
|
Blockly.Arduino.sensebox_sd_write_file = function (block) {
|
||||||
var res = filename.slice(0, 4);
|
|
||||||
if (this.parentBlock_ != null) {
|
if (this.parentBlock_ != null) {
|
||||||
var filename = this.getSurroundParent().getFieldValue('Filename');
|
var filename = this.getSurroundParent().getFieldValue('Filename');
|
||||||
}
|
}
|
||||||
|
var res = filename.slice(0, 4);
|
||||||
var text = Blockly.Arduino.valueToCode(this, 'DATA', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
|
var text = Blockly.Arduino.valueToCode(this, 'DATA', Blockly.Arduino.ORDER_ATOMIC) || '"Keine Eingabe"';
|
||||||
var linebreak = this.getFieldValue('linebreak');
|
var linebreak = this.getFieldValue('linebreak');
|
||||||
if (linebreak == "TRUE") {
|
if (linebreak === "TRUE") {
|
||||||
linebreak = "ln";
|
linebreak = "ln";
|
||||||
} else {
|
} else {
|
||||||
linebreak = "";
|
linebreak = "";
|
||||||
}
|
}
|
||||||
if (text == "gps.getLongitude()" || text == "gps.getLatitude()") {
|
var code = '';
|
||||||
var code = 'dataFile' + res + '.print' + linebreak + '(' + text + ',5);\n'
|
if (text === "gps.getLongitude()" || text === "gps.getLatitude()") {
|
||||||
|
code = 'dataFile' + res + '.print' + linebreak + '(' + text + ',5);\n'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var code = 'dataFile' + res + '.print' + linebreak + '(' + text + ');\n'
|
code = 'dataFile' + res + '.print' + linebreak + '(' + text + ');\n'
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user