-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Open
Labels
help wantedExternal contributions actively solicitedExternal contributions actively solicitedissue: docsDescribes missing or incorrect documentationDescribes missing or incorrect documentation
Milestone
Description
Problem statement
Currently there is a referencesVariables function that is supposed to tell blockly whether a field references variables. But the way blockly gets the variables after it knows they are being referenced is pretty inflexible.
Blockly.Block.prototype.getVars = function() {
var vars = [];
for (var i = 0, input; input = this.inputList[i]; i++) {
for (var j = 0, field; field = input.fieldRow[j]; j++) {
if (field.referencesVariables()) {
vars.push(field.getValue());
}
}
}
return vars;
};
This expects the value of the field to be a variable name, but this is not necessarily true of custom fields. The value could be two variable names, or a variable name and a const, really anything.
Proposals
- Add a
getReferencedVariables()function that fields could override instead ofreferencesVariables(). - Remove
referencesVariables(), instead add atypeproperty to fields, and then have getVars check if the field is a variable field before callinggetValue(). This means only variable fields would be allowed to reference variables.
Additional Information
N/A
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedExternal contributions actively solicitedExternal contributions actively solicitedissue: docsDescribes missing or incorrect documentationDescribes missing or incorrect documentation