mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
@@ -170,7 +170,7 @@ Blockly.JavaScript['lists_getIndex'] = function(block) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
throw 'Unhandled combination (lists_getIndex).';
|
||||
throw Error('Unhandled combination (lists_getIndex).');
|
||||
};
|
||||
|
||||
Blockly.JavaScript['lists_setIndex'] = function(block) {
|
||||
@@ -247,7 +247,7 @@ Blockly.JavaScript['lists_setIndex'] = function(block) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
throw 'Unhandled combination (lists_setIndex).';
|
||||
throw Error('Unhandled combination (lists_setIndex).');
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -295,7 +295,7 @@ Blockly.JavaScript['lists_getSublist'] = function(block) {
|
||||
var at1 = '0';
|
||||
break;
|
||||
default:
|
||||
throw 'Unhandled option (lists_getSublist).';
|
||||
throw Error('Unhandled option (lists_getSublist).');
|
||||
}
|
||||
switch (where2) {
|
||||
case 'FROM_START':
|
||||
@@ -310,7 +310,7 @@ Blockly.JavaScript['lists_getSublist'] = function(block) {
|
||||
var at2 = list + '.length';
|
||||
break;
|
||||
default:
|
||||
throw 'Unhandled option (lists_getSublist).';
|
||||
throw Error('Unhandled option (lists_getSublist).');
|
||||
}
|
||||
code = list + '.slice(' + at1 + ', ' + at2 + ')';
|
||||
} else {
|
||||
@@ -387,7 +387,7 @@ Blockly.JavaScript['lists_split'] = function(block) {
|
||||
}
|
||||
var functionName = 'join';
|
||||
} else {
|
||||
throw 'Unknown mode: ' + mode;
|
||||
throw Error('Unknown mode: ' + mode);
|
||||
}
|
||||
var code = input + '.' + functionName + '(' + delimiter + ')';
|
||||
return [code, Blockly.JavaScript.ORDER_FUNCTION_CALL];
|
||||
|
||||
@@ -171,5 +171,5 @@ Blockly.JavaScript['controls_flow_statements'] = function(block) {
|
||||
case 'CONTINUE':
|
||||
return 'continue;\n';
|
||||
}
|
||||
throw 'Unknown flow statement.';
|
||||
throw Error('Unknown flow statement.');
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ goog.require('Blockly.JavaScript');
|
||||
Blockly.JavaScript['math_number'] = function(block) {
|
||||
// Numeric value.
|
||||
var code = parseFloat(block.getFieldValue('NUM'));
|
||||
var order = code >= 0 ? Blockly.JavaScript.ORDER_ATOMIC :
|
||||
var order = code >= 0 ? Blockly.JavaScript.ORDER_ATOMIC :
|
||||
Blockly.JavaScript.ORDER_UNARY_NEGATION;
|
||||
return [code, order];
|
||||
};
|
||||
@@ -140,7 +140,7 @@ Blockly.JavaScript['math_single'] = function(block) {
|
||||
code = 'Math.atan(' + arg + ') / Math.PI * 180';
|
||||
break;
|
||||
default:
|
||||
throw 'Unknown math operator: ' + operator;
|
||||
throw Error('Unknown math operator: ' + operator);
|
||||
}
|
||||
return [code, Blockly.JavaScript.ORDER_DIVISION];
|
||||
};
|
||||
@@ -357,7 +357,7 @@ Blockly.JavaScript['math_on_list'] = function(block) {
|
||||
code = functionName + '(' + list + ')';
|
||||
break;
|
||||
default:
|
||||
throw 'Unknown operator: ' + func;
|
||||
throw Error('Unknown operator: ' + func);
|
||||
}
|
||||
return [code, Blockly.JavaScript.ORDER_FUNCTION_CALL];
|
||||
};
|
||||
|
||||
@@ -137,7 +137,7 @@ Blockly.JavaScript['text_charAt'] = function(block) {
|
||||
var code = functionName + '(' + text + ')';
|
||||
return [code, Blockly.JavaScript.ORDER_FUNCTION_CALL];
|
||||
}
|
||||
throw 'Unhandled option (text_charAt).';
|
||||
throw Error('Unhandled option (text_charAt).');
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -186,7 +186,7 @@ Blockly.JavaScript['text_getSubstring'] = function(block) {
|
||||
var at1 = '0';
|
||||
break;
|
||||
default:
|
||||
throw 'Unhandled option (text_getSubstring).';
|
||||
throw Error('Unhandled option (text_getSubstring).');
|
||||
}
|
||||
switch (where2) {
|
||||
case 'FROM_START':
|
||||
@@ -201,7 +201,7 @@ Blockly.JavaScript['text_getSubstring'] = function(block) {
|
||||
var at2 = text + '.length';
|
||||
break;
|
||||
default:
|
||||
throw 'Unhandled option (text_getSubstring).';
|
||||
throw Error('Unhandled option (text_getSubstring).');
|
||||
}
|
||||
code = text + '.slice(' + at1 + ', ' + at2 + ')';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user