Remove dead code from ast node (#3183)

This commit is contained in:
alschmiedt
2019-10-07 14:20:37 -07:00
committed by GitHub
parent fcfeb316e7
commit a1b18368f2
2 changed files with 0 additions and 44 deletions

View File

@@ -242,33 +242,6 @@ Blockly.ASTNode.prototype.isConnection = function() {
return this.isConnection_;
};
/**
* Get either the previous editable field, or get the first editable field for
* the given input.
* @param {!(Blockly.Field|Blockly.Connection)} location The current location of
* the cursor, which must be a field or connection.
* @param {!Blockly.Input} parentInput The parentInput of the field.
* @param {boolean=} opt_last If true find the last editable field otherwise get
* the previous field.
* @return {Blockly.ASTNode} The AST node holding the previous or last field or
* null if no previous field exists.
* @private
*/
Blockly.ASTNode.prototype.findPreviousEditableField_ = function(location,
parentInput, opt_last) {
var fieldRow = parentInput.fieldRow;
var fieldIdx = fieldRow.indexOf(location);
var previousField = null;
var startIdx = (opt_last ? fieldRow.length : fieldIdx) - 1;
for (var i = startIdx, field; field = fieldRow[i]; i--) {
if (field.EDITABLE) {
previousField = field;
return Blockly.ASTNode.createFieldNode(previousField);
}
}
return null;
};
/**
* Given an input find the next editable field or an input with a non null
* connection in the same block. The current location must be an input

View File

@@ -110,23 +110,6 @@ suite('ASTNode', function() {
});
suite('HelperFunctions', function() {
test('findPreviousEditableField_', function() {
var input = this.blocks.statementInput1.inputList[0];
var field = input.fieldRow[1];
var prevField = input.fieldRow[0];
var node = Blockly.ASTNode.createFieldNode(prevField);
var editableField = node.findPreviousEditableField_(field, input);
assertEquals(editableField.getLocation(), prevField);
});
test('findPreviousEditableFieldLast_', function() {
var input = this.blocks.statementInput1.inputList[0];
var field = input.fieldRow[0];
var node = Blockly.ASTNode.createFieldNode(field);
var editableField = node.findPreviousEditableField_(field, input, true);
assertEquals(editableField.getLocation(), input.fieldRow[1]);
});
test('findNextForInput_', function() {
var input = this.blocks.statementInput1.inputList[0];
var input2 = this.blocks.statementInput1.inputList[1];