chore: fix missing requires in generators (#5744)

* chore: fix some missing requires in generators

* chore: fix missing requires in dart block generators

* chore: replace Blockly.isNumber with Blockly.utils.string.isNumber in generators

* chore: fix more missing requires in block generators
This commit is contained in:
Rachel Fenichel
2021-11-30 08:51:21 -08:00
committed by GitHub
parent 1a992386ae
commit 4db047ff32
18 changed files with 238 additions and 210 deletions

View File

@@ -24,6 +24,7 @@
goog.provide('Blockly.PHP.lists');
goog.require('Blockly.PHP');
goog.require('Blockly.utils.string');
Blockly.PHP['lists_create_empty'] = function(block) {
@@ -387,7 +388,7 @@ Blockly.PHP['lists_getSublist'] = function(block) {
at2 = Blockly.PHP.getAdjusted(block, 'AT2', 0, false,
Blockly.PHP.ORDER_SUBTRACTION);
length = at2 + ' - ';
if (Blockly.isNumber(String(at1)) || String(at1).match(/^\(.+\)$/)) {
if (Blockly.utils.string.isNumber(String(at1)) || String(at1).match(/^\(.+\)$/)) {
length += at1;
} else {
length += '(' + at1 + ')';
@@ -398,7 +399,7 @@ Blockly.PHP['lists_getSublist'] = function(block) {
at2 = Blockly.PHP.getAdjusted(block, 'AT2', 0, false,
Blockly.PHP.ORDER_SUBTRACTION);
length = 'count(' + list + ') - ' + at2 + ' - ';
if (Blockly.isNumber(String(at1)) || String(at1).match(/^\(.+\)$/)) {
if (Blockly.utils.string.isNumber(String(at1)) || String(at1).match(/^\(.+\)$/)) {
length += at1;
} else {
length += '(' + at1 + ')';
@@ -406,7 +407,7 @@ Blockly.PHP['lists_getSublist'] = function(block) {
break;
case 'LAST':
length = 'count(' + list + ') - ';
if (Blockly.isNumber(String(at1)) || String(at1).match(/^\(.+\)$/)) {
if (Blockly.utils.string.isNumber(String(at1)) || String(at1).match(/^\(.+\)$/)) {
length += at1;
} else {
length += '(' + at1 + ')';