@@ -24,6 +24,7 @@ import * as Blockly from 'blockly/core';
2424import { extendedPythonGenerator } from './extended_python_generator' ;
2525import { GeneratorContext } from './generator_context' ;
2626import * as commonStorage from '../storage/common_storage' ;
27+ import * as storageModule from '../storage/module' ;
2728import * as storageNames from '../storage/names' ;
2829import * as eventHandler from '../blocks/mrc_event_handler' ;
2930import * as classMethodDef from '../blocks/mrc_class_method_def' ;
@@ -46,7 +47,7 @@ export class Editor {
4647 private blocklyWorkspace : Blockly . WorkspaceSvg ;
4748 private generatorContext : GeneratorContext ;
4849 private storage : commonStorage . Storage ;
49- private currentModule : commonStorage . Module | null = null ;
50+ private currentModule : storageModule . Module | null = null ;
5051 private currentProject : commonStorage . Project | null = null ;
5152 private modulePath : string = '' ;
5253 private robotPath : string = '' ;
@@ -120,7 +121,7 @@ export class Editor {
120121 }
121122
122123 public async loadModuleBlocks (
123- currentModule : commonStorage . Module | null ,
124+ currentModule : storageModule . Module | null ,
124125 currentProject : commonStorage . Project | null ) {
125126 this . generatorContext . setModule ( currentModule ) ;
126127 this . currentModule = currentModule ;
@@ -233,7 +234,7 @@ export class Editor {
233234 if ( this . currentModule ) {
234235 return this . currentModule . moduleType ;
235236 }
236- return commonStorage . MODULE_TYPE_UNKNOWN ;
237+ return storageModule . MODULE_TYPE_UNKNOWN ;
237238 }
238239
239240 private getModuleContentText ( ) : string {
@@ -249,8 +250,8 @@ export class Editor {
249250 const components : commonStorage . Component [ ] = this . getComponentsFromWorkspace ( ) ;
250251 const events : commonStorage . Event [ ] = this . getEventsFromWorkspace ( ) ;
251252 const methods : commonStorage . Method [ ] = (
252- this . currentModule ?. moduleType === commonStorage . MODULE_TYPE_ROBOT ||
253- this . currentModule ?. moduleType === commonStorage . MODULE_TYPE_MECHANISM )
253+ this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ||
254+ this . currentModule ?. moduleType === storageModule . MODULE_TYPE_MECHANISM )
254255 ? this . getMethodsForOutsideFromWorkspace ( )
255256 : [ ] ;
256257 return commonStorage . makeModuleContentText (
@@ -259,16 +260,16 @@ export class Editor {
259260
260261 public getMechanismsFromWorkspace ( ) : commonStorage . MechanismInRobot [ ] {
261262 const mechanisms : commonStorage . MechanismInRobot [ ] = [ ] ;
262- if ( this . currentModule ?. moduleType === commonStorage . MODULE_TYPE_ROBOT ) {
263+ if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ) {
263264 mechanismComponentHolder . getMechanisms ( this . blocklyWorkspace , mechanisms ) ;
264265 }
265266 return mechanisms ;
266267 }
267268
268269 public getComponentsFromWorkspace ( ) : commonStorage . Component [ ] {
269270 const components : commonStorage . Component [ ] = [ ] ;
270- if ( this . currentModule ?. moduleType === commonStorage . MODULE_TYPE_ROBOT ||
271- this . currentModule ?. moduleType === commonStorage . MODULE_TYPE_MECHANISM ) {
271+ if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ||
272+ this . currentModule ?. moduleType === storageModule . MODULE_TYPE_MECHANISM ) {
272273 mechanismComponentHolder . getComponents ( this . blocklyWorkspace , components ) ;
273274 }
274275 return components ;
@@ -295,8 +296,8 @@ export class Editor {
295296
296297 public getEventsFromWorkspace ( ) : commonStorage . Event [ ] {
297298 const events : commonStorage . Event [ ] = [ ] ;
298- if ( this . currentModule ?. moduleType === commonStorage . MODULE_TYPE_ROBOT ||
299- this . currentModule ?. moduleType === commonStorage . MODULE_TYPE_MECHANISM ) {
299+ if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ||
300+ this . currentModule ?. moduleType === storageModule . MODULE_TYPE_MECHANISM ) {
300301 mechanismComponentHolder . getEvents ( this . blocklyWorkspace , events ) ;
301302 }
302303 return events ;
@@ -322,7 +323,7 @@ export class Editor {
322323 * Returns the mechanisms defined in the robot.
323324 */
324325 public getMechanismsFromRobot ( ) : commonStorage . MechanismInRobot [ ] {
325- if ( this . currentModule ?. moduleType === commonStorage . MODULE_TYPE_ROBOT ) {
326+ if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ) {
326327 return this . getMechanismsFromWorkspace ( ) ;
327328 }
328329 if ( this . robotContent ) {
@@ -335,7 +336,7 @@ export class Editor {
335336 * Returns the components defined in the robot.
336337 */
337338 public getComponentsFromRobot ( ) : commonStorage . Component [ ] {
338- if ( this . currentModule ?. moduleType === commonStorage . MODULE_TYPE_ROBOT ) {
339+ if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ) {
339340 return this . getComponentsFromWorkspace ( ) ;
340341 }
341342 if ( this . robotContent ) {
@@ -348,7 +349,7 @@ export class Editor {
348349 * Returns the events defined in the robot.
349350 */
350351 public getEventsFromRobot ( ) : commonStorage . Event [ ] {
351- if ( this . currentModule ?. moduleType === commonStorage . MODULE_TYPE_ROBOT ) {
352+ if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ) {
352353 return this . getEventsFromWorkspace ( ) ;
353354 }
354355 if ( this . robotContent ) {
@@ -361,7 +362,7 @@ export class Editor {
361362 * Returns the methods defined in the robot.
362363 */
363364 public getMethodsFromRobot ( ) : commonStorage . Method [ ] {
364- if ( this . currentModule ?. moduleType === commonStorage . MODULE_TYPE_ROBOT ) {
365+ if ( this . currentModule ?. moduleType === storageModule . MODULE_TYPE_ROBOT ) {
365366 return this . getMethodsForWithinFromWorkspace ( ) ;
366367 }
367368 if ( this . robotContent ) {
@@ -373,14 +374,14 @@ export class Editor {
373374 /**
374375 * Returns the mechanisms in this project.
375376 */
376- public getMechanisms ( ) : commonStorage . Mechanism [ ] {
377+ public getMechanisms ( ) : storageModule . Mechanism [ ] {
377378 return this . currentProject ? this . currentProject . mechanisms : [ ] ;
378379 }
379380
380381 /**
381382 * Returns the Mechanism matching the given MechanismInRobot.
382383 */
383- public getMechanism ( mechanismInRobot : commonStorage . MechanismInRobot ) : commonStorage . Mechanism | null {
384+ public getMechanism ( mechanismInRobot : commonStorage . MechanismInRobot ) : storageModule . Mechanism | null {
384385 if ( this . currentProject ) {
385386 for ( const mechanism of this . currentProject . mechanisms ) {
386387 const fullClassName = storageNames . pascalCaseToSnakeCase ( mechanism . className ) + '.' + mechanism . className ;
@@ -395,7 +396,7 @@ export class Editor {
395396 /**
396397 * Returns the components defined in the given mechanism.
397398 */
398- public getComponentsFromMechanism ( mechanism : commonStorage . Mechanism ) : commonStorage . Component [ ] {
399+ public getComponentsFromMechanism ( mechanism : storageModule . Mechanism ) : commonStorage . Component [ ] {
399400 if ( this . currentModule ?. modulePath === mechanism . modulePath ) {
400401 return this . getComponentsFromWorkspace ( ) ;
401402 }
@@ -408,7 +409,7 @@ export class Editor {
408409 /**
409410 * Returns the events defined in the given mechanism.
410411 */
411- public getEventsFromMechanism ( mechanism : commonStorage . Mechanism ) : commonStorage . Event [ ] {
412+ public getEventsFromMechanism ( mechanism : storageModule . Mechanism ) : commonStorage . Event [ ] {
412413 if ( this . currentModule ?. modulePath === mechanism . modulePath ) {
413414 return this . getEventsFromWorkspace ( ) ;
414415 }
@@ -421,7 +422,7 @@ export class Editor {
421422 /**
422423 * Returns the methods defined in the given mechanism.
423424 */
424- public getMethodsFromMechanism ( mechanism : commonStorage . Mechanism ) : commonStorage . Method [ ] {
425+ public getMethodsFromMechanism ( mechanism : storageModule . Mechanism ) : commonStorage . Method [ ] {
425426 if ( this . currentModule ?. modulePath === mechanism . modulePath ) {
426427 return this . getMethodsForWithinFromWorkspace ( ) ;
427428 }
0 commit comments