@@ -191,7 +191,7 @@ FieldLexicalVariable.getGlobalNames = function(optExcludedBlock) {
191191// Shared.showPrefixToUser is true, non-global names are prefixed with labels
192192// specified in blocklyeditor.js
193193FieldLexicalVariable .prototype .getNamesInScope = function () {
194- return FieldLexicalVariable .getNamesInScope (this .sourceBlock_ );
194+ return FieldLexicalVariable .getNamesInScope (this .getSourceBlock () );
195195};
196196
197197/**
@@ -372,29 +372,29 @@ FieldLexicalVariable.prototype.doValueUpdate_ = function(newValue) {
372372 */
373373FieldLexicalVariable .prototype .updateMutation = function () {
374374 const text = this .getText ();
375- if (this .sourceBlock_ && this .sourceBlock_ .getParent ()) {
376- this .sourceBlock_ .eventparam = undefined ;
375+ if (this .getSourceBlock () && this .getSourceBlock () .getParent ()) {
376+ this .getSourceBlock () .eventparam = undefined ;
377377 if (text .indexOf (Blockly .Msg .LANG_VARIABLES_GLOBAL_PREFIX + ' ' ) === 0 ) {
378- this .sourceBlock_ .eventparam = null ;
378+ this .getSourceBlock () .eventparam = null ;
379379 this .translatedName = undefined ;
380380 this .varname = undefined ;
381381 return ;
382382 }
383- let i , parent = this .sourceBlock_ .getParent ();
383+ let i , parent = this .getSourceBlock () .getParent ();
384384 while (parent ) {
385385 const variables = parent .declaredVariables ? parent .declaredVariables () : [];
386386 for (i = 0 ; i < variables .length ; i ++) {
387387 if (variables [i ] == text ) {
388388 if (parent .type == 'component_event' ) {
389389 // Innermost scope is an event block, so eventparam can be set.
390390 const codeName = parent .getParameters ()[i ].name ;
391- this .sourceBlock_ .eventparam = codeName ;
391+ this .getSourceBlock () .eventparam = codeName ;
392392 this .translatedName = variables [i ];
393393 this .varname = codeName ;
394394 return ;
395395 } else {
396396 // Innermost scope is not an event, so eventparam can be nulled.
397- this .sourceBlock_ .eventparam = null ;
397+ this .getSourceBlock () .eventparam = null ;
398398 this .translatedName = undefined ;
399399 this .varname = undefined ;
400400 return ;
@@ -422,12 +422,12 @@ FieldLexicalVariable.prototype.getOptions = function(opt_useCache,
422422 }
423423 const extraOption = opt_extraOption || [];
424424 if (this .isOptionListDynamic ()) {
425- if (!this .generatedOptions_ || !opt_useCache ) {
426- this .generatedOptions_ =
425+ if (!this .generatedOptions || !opt_useCache ) {
426+ this .generatedOptions =
427427 this .menuGenerator_ .call (this ).concat (extraOption );
428- validateOptions (this .generatedOptions_ );
428+ validateOptions (this .generatedOptions );
429429 }
430- return this .generatedOptions_ .concat (extraOption );
430+ return this .generatedOptions .concat (extraOption );
431431 }
432432 return /** @type {!Array<!Array<string>>} */ (this .menuGenerator_ );
433433};
@@ -488,9 +488,9 @@ const validateOptions = function(options) {
488488FieldLexicalVariable .dropdownChange = function (text ) {
489489 if (text ) {
490490 this .doValueUpdate_ (text );
491- const topWorkspace = this .sourceBlock_ .workspace .getTopWorkspace ();
491+ const topWorkspace = this .getSourceBlock () .workspace .getTopWorkspace ();
492492 if (topWorkspace .getWarningHandler ) {
493- topWorkspace .getWarningHandler ().checkErrors (this .sourceBlock_ );
493+ topWorkspace .getWarningHandler ().checkErrors (this .getSourceBlock () );
494494 }
495495 }
496496 // window.setTimeout(Blockly.Variables.refreshFlyoutCategory, 1);
@@ -610,13 +610,13 @@ LexicalVariable.renameGlobal = function(newName) {
610610 // [lyn, 10/27/13] now check legality of identifiers
611611 newName = LexicalVariable .makeLegalIdentifier (newName );
612612
613- this .sourceBlock_ .getField ('NAME' ).doValueUpdate_ (newName );
613+ this .getSourceBlock () .getField ('NAME' ).doValueUpdate_ (newName );
614614
615- const globals = FieldLexicalVariable .getGlobalNames (this .sourceBlock_ );
616- // this.sourceBlock excludes block being renamed from consideration
615+ const globals = FieldLexicalVariable .getGlobalNames (this .getSourceBlock () );
616+ // this.getSourceBlock excludes block being renamed from consideration
617617 // Potentially rename declaration against other occurrences
618618 newName = FieldLexicalVariable .nameNotIn (newName , globals );
619- if (this .sourceBlock_ .rendered ) {
619+ if (this .getSourceBlock () .rendered ) {
620620 // Rename getters and setters
621621 if (Blockly .common .getMainWorkspace ()) {
622622 const blocks = Blockly .common .getMainWorkspace ().getAllBlocks ();
@@ -675,10 +675,10 @@ LexicalVariable.renameParam = function(newName) {
675675 // Default behavior consistent with previous behavior is to use "false" for
676676 // last argument -- I.e., will not rename inner declarations, but may rename
677677 // newName
678- return LexicalVariable .renameParamFromTo (this .sourceBlock_ , oldName ,
678+ return LexicalVariable .renameParamFromTo (this .getSourceBlock () , oldName ,
679679 newName , false );
680680 // Default should be false (as above), but can also play with true:
681- // return LexicalVariable.renameParamFromTo(this.sourceBlock_ ,
681+ // return LexicalVariable.renameParamFromTo(this.getSourceBlock() ,
682682 // oldName, newName, true);
683683};
684684
0 commit comments