Handling Fields that Reference Variables
See original GitHub issueProblem 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 atype
property 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
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Reference Variables
A reference variable does not store its own values. Instead, when you reference the reference variable, OpenROAD uses the values in the corresponding...
Read more >Handle references - Progress Software
Examples of handle references include CURRENT-WINDOW and BUFFER bCust:HANDLE (from the previous example). You can access the handle to a static handle-based ...
Read more >Reference Variable in Java - GeeksforGeeks
Reference variables hold the objects/values of reference types in Java. ... It is used if parent class and child class have the same...
Read more >Reference variables - IBM
A new reference variable has a null value by default, and causes a NullValueException when you use it to try to access a...
Read more >References to fields, measures, and variables - Qlik | Help
You should not use the same name for a field and a variable (or a measure). But if you do and there is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah definitely! Once one of the blockly people gives a reply about which proposal they like.
@abhinavsagar feel free to update the jsdoc (or let us know if it’s affecting you in some way). =)