@@ -33,8 +33,8 @@ import { createFieldDropdown } from '../fields/FieldDropdown';
3333import { createFieldNonEditableText } from '../fields/FieldNonEditableText' ;
3434import { MRC_STYLE_FUNCTIONS } from '../themes/styles'
3535import * as toolboxItems from '../toolbox/items' ;
36- import * as commonStorage from '../storage/common_storage' ;
3736import * as storageModule from '../storage/module' ;
37+ import * as storageModuleContent from '../storage/module_content' ;
3838
3939
4040// A block to call a python function.
@@ -497,11 +497,11 @@ const CALL_PYTHON_FUNCTION = {
497497 } ,
498498 mutateMethodCaller : function (
499499 this : CallPythonFunctionBlock ,
500- methodOrEvent : commonStorage . Method | commonStorage . Event
500+ methodOrEvent : storageModuleContent . Method | storageModuleContent . Event
501501 ) : void {
502502 // mutateMethodCaller is called when the method or event definition block in the same module is modified.
503503 if ( this . mrcFunctionKind == FunctionKind . EVENT ) {
504- const event = methodOrEvent as commonStorage . Event ;
504+ const event = methodOrEvent as storageModuleContent . Event ;
505505 this . mrcArgs = [ ] ;
506506 event . args . forEach ( ( arg ) => {
507507 this . mrcArgs . push ( {
@@ -510,7 +510,7 @@ const CALL_PYTHON_FUNCTION = {
510510 } ) ;
511511 } ) ;
512512 } else if ( this . mrcFunctionKind == FunctionKind . INSTANCE_WITHIN ) {
513- const method = methodOrEvent as commonStorage . Method ;
513+ const method = methodOrEvent as storageModuleContent . Method ;
514514 this . mrcReturnType = method . returnType ;
515515 this . mrcArgs = [ ] ;
516516 // We don't include the arg for the self argument because we don't need a socket for it.
@@ -523,9 +523,9 @@ const CALL_PYTHON_FUNCTION = {
523523 }
524524 this . updateBlock_ ( ) ;
525525 } ,
526- getComponentsFromRobot : function ( this : CallPythonFunctionBlock ) : commonStorage . Component [ ] {
526+ getComponentsFromRobot : function ( this : CallPythonFunctionBlock ) : storageModuleContent . Component [ ] {
527527 // Get the list of components whose type matches this.mrcComponentClassName.
528- const components : commonStorage . Component [ ] = [ ] ;
528+ const components : storageModuleContent . Component [ ] = [ ] ;
529529 const editor = Editor . getEditorForBlocklyWorkspace ( this . workspace ) ;
530530 if ( editor ) {
531531 editor . getComponentsFromRobot ( ) . forEach ( component => {
@@ -551,7 +551,7 @@ const CALL_PYTHON_FUNCTION = {
551551 // visible warning on it.
552552 if ( this . mrcFunctionKind === FunctionKind . INSTANCE_COMPONENT ) {
553553 let foundComponent = false ;
554- const componentsInScope : commonStorage . Component [ ] = [ ] ;
554+ const componentsInScope : storageModuleContent . Component [ ] = [ ] ;
555555 componentsInScope . push ( ...this . getComponentsFromRobot ( ) ) ;
556556 if ( editor . getCurrentModuleType ( ) === storageModule . MODULE_TYPE_MECHANISM ) {
557557 componentsInScope . push ( ...editor . getComponentsFromWorkspace ( ) ) ;
@@ -662,7 +662,7 @@ const CALL_PYTHON_FUNCTION = {
662662
663663 let foundMechanismMethod = false ;
664664 const mechanism = editor . getMechanism ( mechanismInRobot ) ;
665- const mechanismMethods : commonStorage . Method [ ] = mechanism
665+ const mechanismMethods : storageModuleContent . Method [ ] = mechanism
666666 ? editor . getMethodsFromMechanism ( mechanism ) : [ ] ;
667667 for ( const mechanismMethod of mechanismMethods ) {
668668 if ( mechanismMethod . blockId === this . mrcOtherBlockId ) {
@@ -883,7 +883,7 @@ export function renameMethodCallers(workspace: Blockly.Workspace, otherBlockId:
883883}
884884
885885export function mutateMethodCallers (
886- workspace : Blockly . Workspace , otherBlockId : string , methodOrEvent : commonStorage . Method | commonStorage . Event ) {
886+ workspace : Blockly . Workspace , otherBlockId : string , methodOrEvent : storageModuleContent . Method | storageModuleContent . Event ) {
887887 const oldRecordUndo = Blockly . Events . getRecordUndo ( ) ;
888888
889889 getMethodCallers ( workspace , otherBlockId ) . forEach ( block => {
@@ -1071,14 +1071,14 @@ function createInstanceMethodBlock(
10711071}
10721072
10731073export function addInstanceWithinBlocks (
1074- methods : commonStorage . Method [ ] ,
1074+ methods : storageModuleContent . Method [ ] ,
10751075 contents : toolboxItems . ContentsType [ ] ) {
10761076 methods . forEach ( method => {
10771077 contents . push ( createInstanceWithinBlock ( method ) ) ;
10781078 } ) ;
10791079}
10801080
1081- function createInstanceWithinBlock ( method : commonStorage . Method ) : toolboxItems . Block {
1081+ function createInstanceWithinBlock ( method : storageModuleContent . Method ) : toolboxItems . Block {
10821082 const extraState : CallPythonFunctionExtraState = {
10831083 functionKind : FunctionKind . INSTANCE_WITHIN ,
10841084 returnType : method . returnType ,
@@ -1089,7 +1089,7 @@ function createInstanceWithinBlock(method: commonStorage.Method): toolboxItems.B
10891089 const fields : { [ key : string ] : any } = { } ;
10901090 fields [ FIELD_FUNCTION_NAME ] = method . visibleName ;
10911091 const inputs : { [ key : string ] : any } = { } ;
1092- // Convert method.args from commonStorage .MethodArg[] to ArgData[].
1092+ // Convert method.args from storageModuleContent .MethodArg[] to ArgData[].
10931093 const args : ArgData [ ] = [ ] ;
10941094 // We don't include the arg for the self argument because we don't need a socket for it.
10951095 for ( let i = 1 ; i < method . args . length ; i ++ ) {
@@ -1104,7 +1104,7 @@ function createInstanceWithinBlock(method: commonStorage.Method): toolboxItems.B
11041104}
11051105
11061106export function getInstanceComponentBlocks (
1107- component : commonStorage . Component ) : toolboxItems . ContentsType [ ] {
1107+ component : storageModuleContent . Component ) : toolboxItems . ContentsType [ ] {
11081108 const contents : toolboxItems . ContentsType [ ] = [ ] ;
11091109
11101110 const classData = getClassData ( component . className ) ;
@@ -1132,7 +1132,7 @@ export function getInstanceComponentBlocks(
11321132}
11331133
11341134function createInstanceComponentBlock (
1135- component : commonStorage . Component , functionData : FunctionData ) : toolboxItems . Block {
1135+ component : storageModuleContent . Component , functionData : FunctionData ) : toolboxItems . Block {
11361136 const extraState : CallPythonFunctionExtraState = {
11371137 functionKind : FunctionKind . INSTANCE_COMPONENT ,
11381138 returnType : functionData . returnType ,
@@ -1156,14 +1156,14 @@ function createInstanceComponentBlock(
11561156}
11571157
11581158export function addInstanceRobotBlocks (
1159- methods : commonStorage . Method [ ] ,
1159+ methods : storageModuleContent . Method [ ] ,
11601160 contents : toolboxItems . ContentsType [ ] ) {
11611161 methods . forEach ( method => {
11621162 contents . push ( createInstanceRobotBlock ( method ) ) ;
11631163 } ) ;
11641164}
11651165
1166- function createInstanceRobotBlock ( method : commonStorage . Method ) : toolboxItems . Block {
1166+ function createInstanceRobotBlock ( method : storageModuleContent . Method ) : toolboxItems . Block {
11671167 const extraState : CallPythonFunctionExtraState = {
11681168 functionKind : FunctionKind . INSTANCE_ROBOT ,
11691169 returnType : method . returnType ,
@@ -1174,7 +1174,7 @@ function createInstanceRobotBlock(method: commonStorage.Method): toolboxItems.Bl
11741174 const fields : { [ key : string ] : any } = { } ;
11751175 fields [ FIELD_FUNCTION_NAME ] = method . visibleName ;
11761176 const inputs : { [ key : string ] : any } = { } ;
1177- // Convert method.args from commonStorage .MethodArg[] to ArgData[].
1177+ // Convert method.args from storageModuleContent .MethodArg[] to ArgData[].
11781178 const args : ArgData [ ] = [ ] ;
11791179 // We don't include the arg for the self argument because we don't need a socket for it.
11801180 for ( let i = 1 ; i < method . args . length ; i ++ ) {
@@ -1189,17 +1189,17 @@ function createInstanceRobotBlock(method: commonStorage.Method): toolboxItems.Bl
11891189}
11901190
11911191export function addInstanceMechanismBlocks (
1192- mechanismInRobot : commonStorage . MechanismInRobot ,
1193- methods : commonStorage . Method [ ] ,
1192+ mechanismInRobot : storageModuleContent . MechanismInRobot ,
1193+ methods : storageModuleContent . Method [ ] ,
11941194 contents : toolboxItems . ContentsType [ ] ) {
11951195 methods . forEach ( method => {
11961196 contents . push ( createInstanceMechanismBlock ( mechanismInRobot , method ) ) ;
11971197 } ) ;
11981198}
11991199
12001200function createInstanceMechanismBlock (
1201- mechanismInRobot : commonStorage . MechanismInRobot ,
1202- method : commonStorage . Method ) : toolboxItems . Block {
1201+ mechanismInRobot : storageModuleContent . MechanismInRobot ,
1202+ method : storageModuleContent . Method ) : toolboxItems . Block {
12031203 const extraState : CallPythonFunctionExtraState = {
12041204 functionKind : FunctionKind . INSTANCE_MECHANISM ,
12051205 returnType : method . returnType ,
@@ -1213,7 +1213,7 @@ function createInstanceMechanismBlock(
12131213 fields [ FIELD_MECHANISM_NAME ] = mechanismInRobot . name ;
12141214 fields [ FIELD_FUNCTION_NAME ] = method . visibleName ;
12151215 const inputs : { [ key : string ] : any } = { } ;
1216- // Convert method.args from commonStorage .MethodArg[] to ArgData[].
1216+ // Convert method.args from storageModuleContent .MethodArg[] to ArgData[].
12171217 const args : ArgData [ ] = [ ] ;
12181218 // For INSTANCE_MECHANISM functions, the 0 argument is 'self', but
12191219 // self is represented by the FIELD_MECHANISM_NAME field.
@@ -1230,14 +1230,14 @@ function createInstanceMechanismBlock(
12301230}
12311231
12321232export function addFireEventBlocks (
1233- events : commonStorage . Event [ ] ,
1233+ events : storageModuleContent . Event [ ] ,
12341234 contents : toolboxItems . ContentsType [ ] ) {
12351235 events . forEach ( event => {
12361236 contents . push ( createFireEventBlock ( event ) ) ;
12371237 } ) ;
12381238}
12391239
1240- function createFireEventBlock ( event : commonStorage . Event ) : toolboxItems . Block {
1240+ function createFireEventBlock ( event : storageModuleContent . Event ) : toolboxItems . Block {
12411241 const extraState : CallPythonFunctionExtraState = {
12421242 functionKind : FunctionKind . EVENT ,
12431243 returnType : RETURN_TYPE_NONE ,
@@ -1247,7 +1247,7 @@ function createFireEventBlock(event: commonStorage.Event): toolboxItems.Block {
12471247 const fields : { [ key : string ] : any } = { } ;
12481248 fields [ FIELD_EVENT_NAME ] = event . name ;
12491249 const inputs : { [ key : string ] : any } = { } ;
1250- // Convert event.args from commonStorage .MethodArg[] to ArgData[].
1250+ // Convert event.args from storageModuleContent .MethodArg[] to ArgData[].
12511251 const args : ArgData [ ] = [ ] ;
12521252 event . args . forEach ( methodArg => {
12531253 args . push ( {
0 commit comments