mirror of
https://github.com/google/blockly.git
synced 2026-01-08 01:20:12 +01:00
Collapse the five 0/1-based index flags into one option.
This commit is contained in:
@@ -84,12 +84,6 @@ Blockly.Dart.ORDER_CASCADE = 15; // ..
|
||||
Blockly.Dart.ORDER_ASSIGNMENT = 16; // = *= /= ~/= %= += -= <<= >>= &= ^= |=
|
||||
Blockly.Dart.ORDER_NONE = 99; // (...)
|
||||
|
||||
/**
|
||||
* Allow for switching between one and zero based indexing for lists and text,
|
||||
* one based by default.
|
||||
*/
|
||||
Blockly.Dart.ONE_BASED_INDEXING = true;
|
||||
|
||||
/**
|
||||
* Initialise the database of variable names.
|
||||
* @param {!Blockly.Workspace} workspace Workspace to generate code from.
|
||||
@@ -232,10 +226,10 @@ Blockly.Dart.getAdjusted = function(block, atId, opt_delta, opt_negate,
|
||||
opt_order) {
|
||||
var delta = opt_delta || 0;
|
||||
var order = opt_order || Blockly.Dart.ORDER_NONE;
|
||||
if (Blockly.Dart.ONE_BASED_INDEXING) {
|
||||
if (block.workspace.options.oneBasedIndex) {
|
||||
delta--;
|
||||
}
|
||||
var defaultAtIndex = Blockly.Dart.ONE_BASED_INDEXING ? '1' : '0';
|
||||
var defaultAtIndex = block.workspace.options.oneBasedIndex ? '1' : '0';
|
||||
if (delta) {
|
||||
var at = Blockly.Dart.valueToCode(block, atId,
|
||||
Blockly.Dart.ORDER_ADDITIVE) || defaultAtIndex;
|
||||
|
||||
Reference in New Issue
Block a user