mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
Collapse the five 0/1-based index flags into one option.
This commit is contained in:
@@ -131,12 +131,6 @@ Blockly.PHP.ORDER_OVERRIDES = [
|
||||
[Blockly.PHP.ORDER_LOGICAL_OR, Blockly.PHP.ORDER_LOGICAL_OR]
|
||||
];
|
||||
|
||||
/**
|
||||
* Allow for switching between one and zero based indexing for lists and text,
|
||||
* one based by default.
|
||||
*/
|
||||
Blockly.PHP.ONE_BASED_INDEXING = true;
|
||||
|
||||
/**
|
||||
* Initialise the database of variable names.
|
||||
* @param {!Blockly.Workspace} workspace Workspace to generate code from.
|
||||
@@ -257,10 +251,10 @@ Blockly.PHP.getAdjusted = function(block, atId, opt_delta, opt_negate,
|
||||
opt_order) {
|
||||
var delta = opt_delta || 0;
|
||||
var order = opt_order || Blockly.PHP.ORDER_NONE;
|
||||
if (Blockly.PHP.ONE_BASED_INDEXING) {
|
||||
if (block.workspace.options.oneBasedIndex) {
|
||||
delta--;
|
||||
}
|
||||
var defaultAtIndex = Blockly.PHP.ONE_BASED_INDEXING ? '1' : '0';
|
||||
var defaultAtIndex = block.workspace.options.oneBasedIndex ? '1' : '0';
|
||||
if (delta > 0) {
|
||||
var at = Blockly.PHP.valueToCode(block, atId,
|
||||
Blockly.PHP.ORDER_ADDITION) || defaultAtIndex;
|
||||
|
||||
Reference in New Issue
Block a user