mirror of
https://github.com/google/blockly.git
synced 2025-12-15 13:50:08 +01:00
release: Merge branch 'develop' into rc/v11.0.0
This commit is contained in:
@@ -251,7 +251,6 @@ export class JavascriptGenerator extends CodeGenerator {
|
||||
* @param code The JavaScript code created for this block.
|
||||
* @param thisOnly True to generate code for only this statement.
|
||||
* @returns JavaScript code with comments and subsequent blocks added.
|
||||
* @protected
|
||||
*/
|
||||
scrub_(block: Block, code: string, thisOnly = false): string {
|
||||
let commentCode = '';
|
||||
|
||||
@@ -35,7 +35,7 @@ const CONTINUE_STATEMENT = 'goto continue\n';
|
||||
* @returns Generated label or '' if unnecessary
|
||||
*/
|
||||
function addContinueLabel(branch: string, indent: string): string {
|
||||
if (branch.indexOf(CONTINUE_STATEMENT) !== -1) {
|
||||
if (branch.includes(CONTINUE_STATEMENT)) {
|
||||
// False positives are possible (e.g. a string literal), but are harmless.
|
||||
return branch + indent + '::continue::\n';
|
||||
} else {
|
||||
|
||||
@@ -27,7 +27,7 @@ export function procedures_defreturn(block: Block, generator: PhpGenerator) {
|
||||
for (const variable of usedVariables) {
|
||||
const varName = variable.name;
|
||||
// getVars returns parameter names, not ids, for procedure blocks
|
||||
if (block.getVars().indexOf(varName) === -1) {
|
||||
if (!block.getVars().includes(varName)) {
|
||||
globals.push(generator.getVariableName(varName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export function procedures_defreturn(block: Block, generator: PythonGenerator) {
|
||||
for (const variable of usedVariables) {
|
||||
const varName = variable.name;
|
||||
// getVars returns parameter names, not ids, for procedure blocks
|
||||
if (block.getVars().indexOf(varName) === -1) {
|
||||
if (!block.getVars().includes(varName)) {
|
||||
globals.push(generator.getVariableName(varName));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,8 +243,8 @@ export class PythonGenerator extends CodeGenerator {
|
||||
|
||||
// Follow the CPython behaviour of repr() for a non-byte string.
|
||||
let quote = "'";
|
||||
if (string.indexOf("'") !== -1) {
|
||||
if (string.indexOf('"') === -1) {
|
||||
if (string.includes("'")) {
|
||||
if (!string.includes('"')) {
|
||||
quote = '"';
|
||||
} else {
|
||||
string = string.replace(/'/g, "\\'");
|
||||
@@ -276,7 +276,6 @@ export class PythonGenerator extends CodeGenerator {
|
||||
* @param code The Python code created for this block.
|
||||
* @param thisOnly True to generate code for only this statement.
|
||||
* @returns Python code with comments and subsequent blocks added.
|
||||
|
||||
*/
|
||||
scrub_(block: Block, code: string, thisOnly = false): string {
|
||||
let commentCode = '';
|
||||
|
||||
Reference in New Issue
Block a user