release: Merge branch 'develop' into rc/v11.0.0

This commit is contained in:
Christopher Allen
2024-03-18 19:57:04 +00:00
40 changed files with 69 additions and 71 deletions

View File

@@ -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 = '';

View File

@@ -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 {

View File

@@ -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));
}
}

View File

@@ -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));
}
}

View File

@@ -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 = '';