MCPcopy
hub / github.com/RaspberryPiFoundation/blockly / getVarModels

Method getVarModels

packages/blockly/core/block.ts:1165–1180  ·  view source on GitHub ↗

* Return all variables referenced by this block. * * @returns List of variable models.

()

Source from the content-addressed store, hash-verified

1163 * @returns List of variable models.
1164 */
1165 getVarModels(): IVariableModel<IVariableState>[] {
1166 const vars = [];
1167 for (const field of this.getFields()) {
1168 if (field.referencesVariables()) {
1169 const model = this.workspace
1170 .getVariableMap()
1171 .getVariableById(field.getValue() as string);
1172 // Check if the variable actually exists (and isn't just a potential
1173 // variable).
1174 if (model) {
1175 vars.push(model);
1176 }
1177 }
1178 }
1179 return vars;
1180 }
1181
1182 /**
1183 * Notification that a variable is renaming but keeping the same ID. If the

Callers 15

allUsedVarModelsFunction · 0.80
getVariableUsesByIdFunction · 0.80
procedures.tsFile · 0.80
assertArgsFunction · 0.80
assertBlockVarModelNameFunction · 0.80
assertBlockVarModelsFunction · 0.80
assertDefBlockStructureFunction · 0.80
procedures_defreturnFunction · 0.80
procedures_callreturnFunction · 0.80
procedures_defreturnFunction · 0.80
procedures_callreturnFunction · 0.80

Calls 5

getFieldsMethod · 0.95
referencesVariablesMethod · 0.80
getVariableMapMethod · 0.80
getVariableByIdMethod · 0.65
getValueMethod · 0.45

Tested by

no test coverage detected