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