From 0dfc93f72d70ce367e981f511c89aa45b85ed2b9 Mon Sep 17 00:00:00 2001 From: "duzc2dtw@gmail.com" Date: Wed, 12 Sep 2018 11:19:17 +0800 Subject: [PATCH] get the variable from the field and use its type. --- blocks/variables_dynamic.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blocks/variables_dynamic.js b/blocks/variables_dynamic.js index 36027ba6b..abc997a62 100644 --- a/blocks/variables_dynamic.js +++ b/blocks/variables_dynamic.js @@ -102,14 +102,14 @@ Blockly.Constants.VariablesDynamic.CUSTOM_CONTEXT_MENU_VARIABLE_GETTER_SETTER_MI } var opposite_type; var contextMenuMsg; - var varType; + var id = this.getFieldValue('VAR'); + var variableModel = this.workspace.getVariableById(id); + var varType = variableModel.type if (this.type == 'variables_get_dynamic') { opposite_type = 'variables_set_dynamic'; - varType = this.outputConnection.check_ ? this.outputConnection.check_[0] : ""; contextMenuMsg = Blockly.Msg['VARIABLES_GET_CREATE_SET']; } else { opposite_type = 'variables_get_dynamic'; - varType = this.inputList[0].connection.check_ ? this.inputList[0].connection.check_[0] : ""; contextMenuMsg = Blockly.Msg['VARIABLES_SET_CREATE_GET']; }