Generated JS helper functions should be camelCase.

Complying with Google style guide.
This commit is contained in:
Neil Fraser
2016-06-01 17:18:02 -07:00
parent 0e29021b31
commit 32192850ad
5 changed files with 23 additions and 23 deletions

View File

@@ -48,7 +48,7 @@ Blockly.JavaScript['lists_create_with'] = function(block) {
Blockly.JavaScript['lists_repeat'] = function(block) {
// Create a list with one element repeated.
var functionName = Blockly.JavaScript.provideFunction_(
'lists_repeat',
'listsRepeat',
[ 'function ' + Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_ +
'(value, n) {',
' var array = [];',
@@ -145,7 +145,7 @@ Blockly.JavaScript['lists_getIndex'] = function(block) {
return [code, Blockly.JavaScript.ORDER_FUNCTION_CALL];
} else if (mode == 'GET_REMOVE' || mode == 'REMOVE') {
var functionName = Blockly.JavaScript.provideFunction_(
'lists_remove_from_end',
'listsRemoveFromEnd',
[ 'function ' + Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_ +
'(list, x) {',
' x = list.length - x;',
@@ -160,7 +160,7 @@ Blockly.JavaScript['lists_getIndex'] = function(block) {
}
} else if (where == 'RANDOM') {
var functionName = Blockly.JavaScript.provideFunction_(
'lists_get_random_item',
'listsGetRandomItem',
[ 'function ' + Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_ +
'(list, remove) {',
' var x = Math.floor(Math.random() * list.length);',
@@ -272,7 +272,7 @@ Blockly.JavaScript['lists_getSublist'] = function(block) {
var code = list + '.concat()';
} else {
var functionName = Blockly.JavaScript.provideFunction_(
'lists_get_sublist',
'listsGetSublist',
[ 'function ' + Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_ +
'(list, where1, at1, where2, at2) {',
' function getAt(where, at) {',
@@ -307,7 +307,7 @@ Blockly.JavaScript['lists_sort'] = function(block) {
var direction = block.getFieldValue('DIRECTION') === '1' ? 1 : -1;
var type = block.getFieldValue('TYPE');
var getCompareFunctionName = Blockly.JavaScript.provideFunction_(
'lists_get_sort_compare',
'listsGetSortCompare',
['function ' + Blockly.JavaScript.FUNCTION_NAME_PLACEHOLDER_ +
'(type, direction) {',
' var compareFuncs = {',
@@ -322,8 +322,8 @@ Blockly.JavaScript['lists_sort'] = function(block) {
' var compare = compareFuncs[type];',
' return function(a, b) { return compare(a, b) * direction; }',
'}']);
return ['(' + listCode + ').slice().sort(' +
getCompareFunctionName + '("' + type + '", ' + direction + '))',
return ['(' + listCode + ').slice().sort(' +
getCompareFunctionName + '("' + type + '", ' + direction + '))',
Blockly.JavaScript.ORDER_FUNCTION_CALL];
};