mirror of
https://github.com/google/blockly.git
synced 2026-01-09 01:50:11 +01:00
chore: merge develop into rc/v11
This commit is contained in:
@@ -35,8 +35,17 @@ export function procedures_defreturn(block: Block, generator: DartGenerator) {
|
||||
generator.INDENT,
|
||||
);
|
||||
}
|
||||
const branch = generator.statementToCode(block, 'STACK');
|
||||
let returnValue = generator.valueToCode(block, 'RETURN', Order.NONE) || '';
|
||||
let branch = '';
|
||||
if (block.getInput('STACK')) {
|
||||
// The 'procedures_defreturn' block might not have a STACK input.
|
||||
branch = generator.statementToCode(block, 'STACK');
|
||||
}
|
||||
let returnValue = '';
|
||||
if (block.getInput('RETURN')) {
|
||||
// The 'procedures_defnoreturn' block (which shares this code)
|
||||
// does not have a RETURN input.
|
||||
returnValue = generator.valueToCode(block, 'RETURN', Order.NONE) || '';
|
||||
}
|
||||
let xfix2 = '';
|
||||
if (branch && returnValue) {
|
||||
// After executing the function body, revisit this block for the return.
|
||||
|
||||
@@ -118,10 +118,12 @@ export function text_charAt(
|
||||
return [code, Order.UNARY_POSTFIX];
|
||||
}
|
||||
case 'LAST':
|
||||
at = 1;
|
||||
// Fall through.
|
||||
case 'FROM_END': {
|
||||
at = generator.getAdjusted(block, 'AT', 1);
|
||||
if (where === 'LAST') {
|
||||
at = 1;
|
||||
} else {
|
||||
at = generator.getAdjusted(block, 'AT', 1);
|
||||
}
|
||||
const functionName = generator.provideFunction_(
|
||||
'text_get_from_end',
|
||||
`
|
||||
@@ -130,7 +132,7 @@ String ${generator.FUNCTION_NAME_PLACEHOLDER_}(String text, num x) {
|
||||
}
|
||||
`,
|
||||
);
|
||||
const code = functionName + '(' + text + ', ' + at + ')';
|
||||
const code = `${functionName}(${text}, ${at})`;
|
||||
return [code, Order.UNARY_POSTFIX];
|
||||
}
|
||||
case 'RANDOM': {
|
||||
|
||||
Reference in New Issue
Block a user