Skip to content

Commit 64af1e9

Browse files
1 parent c2f4e8e commit 64af1e9

2 files changed

Lines changed: 4 additions & 74 deletions

File tree

block-lexical-variables/src/blocks/lexical-variables.js

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -282,16 +282,10 @@ Blockly.Blocks['local_declaration_statement'] = {
282282
// list. [lyn, 03/04/13] As of change to, Blockly 1636, there is no longer
283283
// a collapsed input at end.
284284

285-
// Remember last (= body) input
286-
const bodyInput = this.inputList[this.inputList.length - 1]; // Body input
287285
// for local
288286
// declaration
289287
const numDecls = this.inputList.length - 1;
290288

291-
// [lyn, 07/03/14] stop rendering until block is recreated
292-
const savedRendered = this.rendered;
293-
this.rendered = false;
294-
295289
// Modify this local-in-do block according to arrangement of name blocks in
296290
// mutator editor. Remove all the local declaration inputs ...
297291
const thisBlock = this; // Grab correct object for use in thunk below
@@ -305,9 +299,7 @@ Blockly.Blocks['local_declaration_statement'] = {
305299
},
306300
);
307301

308-
// Empty the inputList and recreate it, building local initializers from
309-
// mutator
310-
this.inputList = [];
302+
// Build local initializers from mutator
311303
this.localNames_ = names;
312304

313305
for (let i = 0; i < names.length; i++) {
@@ -331,13 +323,7 @@ Blockly.Blocks['local_declaration_statement'] = {
331323
}
332324

333325
// Now put back last (= body) input
334-
this.inputList = this.inputList.concat(bodyInput);
335-
336-
this.rendered = savedRendered;
337-
if (this.rendered) {
338-
this.initSvg();
339-
this.render();
340-
}
326+
this.moveInputBefore(this.bodyInputName);
341327
},
342328
// [lyn, 10/27/13] Introduced this to correctly handle renaming of mutatorarg
343329
// in open mutator when procedure parameter flydown name is edited.
@@ -421,17 +407,7 @@ Blockly.Blocks['local_declaration_statement'] = {
421407
// Reconstruct inputs only if local list has changed
422408
if (!LexicalVariable.stringListsEqual(this.localNames_,
423409
newLocalNames)) {
424-
// Switch off rendering while the block is rebuilt.
425-
// var savedRendered = this.rendered;
426-
// this.rendered = false;
427-
428410
this.updateDeclarationInputs_(newLocalNames, initializers);
429-
430-
// Restore rendering and show the changes.
431-
// this.rendered = savedRendered;
432-
// if (this.rendered) {
433-
// this.render();
434-
// }
435411
}
436412
},
437413
saveConnections: function(containerBlock) {

block-lexical-variables/src/blocks/procedures.js

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,6 @@ Blockly.Blocks['procedures_defnoreturn'] = {
166166
}
167167

168168
const procName = this.getFieldValue('NAME');
169-
// save the first two input lines and the last input line
170-
// to be re added to the block later
171-
// var firstInput = this.inputList[0];
172-
// [lyn, 10/24/13] need to reconstruct first input
173-
174-
// Body of procedure
175-
const bodyInput = this.inputList[this.inputList.length - 1];
176-
177-
// stop rendering until block is recreated
178-
const savedRendered = this.rendered;
179-
this.rendered = false;
180169

181170
// remove first input
182171
// console.log("updateParams_: remove input HEADER");
@@ -213,9 +202,6 @@ Blockly.Blocks['procedures_defnoreturn'] = {
213202
}
214203
}
215204

216-
// empty the inputList then recreate it
217-
this.inputList = [];
218-
219205
// console.log("updateParams_: create input HEADER");
220206
const headerInput = this.createHeader(procName);
221207
// const headerInput =
@@ -241,24 +227,9 @@ Blockly.Blocks['procedures_defnoreturn'] = {
241227
}
242228
}
243229

244-
// put the last two arguments back
245-
this.inputList = this.inputList.concat(bodyInput);
230+
// Now put back last (= body) input
231+
this.moveInputBefore(this.bodyInputName);
246232

247-
this.rendered = savedRendered;
248-
// [lyn, 10/28/13] I thought this rerendering was unnecessary. But I was
249-
// wrong! Without it, get bug noticed by Andrew in which toggling
250-
// horizontal -> vertical params in procedure decl doesn't handle body tag
251-
// appropriately!
252-
for (let i = 0; i < this.inputList.length; i++) {
253-
if (this.inputList[i].sourceBlock.rendered) {
254-
this.inputList[i].init();
255-
} else {
256-
this.inputList[i].initModel();
257-
}
258-
}
259-
if (this.rendered) {
260-
this.render();
261-
}
262233
// set in BlocklyPanel.java on successful load
263234
if (this.workspace.loadCompleted) {
264235
Blockly.Procedures.mutateCallers(this);
@@ -893,9 +864,6 @@ Blockly.Blocks['procedures_callnoreturn'] = {
893864
this.quarkArguments_ = [];
894865
}
895866
}
896-
// Switch off rendering while the block is rebuilt.
897-
const savedRendered = this.rendered;
898-
this.rendered = false;
899867
// Update the quarkConnections_ with existing connections.
900868
for (x = 0; this.getInput('ARG' + x); x++) {
901869
input = this.getInput('ARG' + x);
@@ -933,20 +901,6 @@ Blockly.Blocks['procedures_callnoreturn'] = {
933901
}
934902
}
935903
}
936-
// Restore rendering and show the changes.
937-
this.rendered = savedRendered;
938-
if (!this.workspace.rendered) {
939-
// workspace hasn't been rendered yet, so other connections may
940-
// not yet exist.
941-
return;
942-
}
943-
// Initialize the new inputs.
944-
for (x = 0; x < this.arguments_.length; x++) {
945-
this.getInput('ARG' + x).init();
946-
}
947-
if (this.rendered) {
948-
this.render();
949-
}
950904
},
951905
mutationToDom: function() {
952906
// Save the name and arguments (none of which are editable).

0 commit comments

Comments
 (0)