@@ -34,7 +34,6 @@ export class ExtendedPythonGenerator extends PythonGenerator {
3434  private  context : GeneratorContext  |  null  =  null ; 
3535
3636  private  classMethods : { [ key : string ] : string }  =  Object . create ( null ) ; 
37-   private  mapComponentNameToVarName : { [ key : string ] : string }  =  Object . create ( null ) ; 
3837
3938  constructor ( )  { 
4039    super ( 'Python' ) ; 
@@ -55,18 +54,6 @@ export class ExtendedPythonGenerator extends PythonGenerator {
5554      ) ; 
5655    } 
5756    this . definitions_ [ 'variables' ]  =  defvars . join ( '\n' ) ; 
58- 
59-     // Collect the components used in all mrc_call_python_function blocks. 
60-     workspace . getBlocksByType ( 'mrc_call_python_function' ,  false ) . forEach ( ( block )  =>  { 
61-       const  callPythonFunctionBlock  =  block  as  CallPythonFunctionBlock ; 
62-       const  componentName  =  callPythonFunctionBlock . getComponentName ( ) ; 
63-       if  ( componentName )  { 
64-         if  ( ! ( componentName  in  this . mapComponentNameToVarName ) )  { 
65-           const  varName  =  this . nameDB_ ! . getDistinctName ( componentName ,  'VARIABLE' ) ; 
66-           this . mapComponentNameToVarName [ componentName ]  =  varName ; 
67-         } 
68-       } 
69-     } ) ; 
7057  } 
7158
7259  /* 
@@ -80,10 +67,6 @@ export class ExtendedPythonGenerator extends PythonGenerator {
8067      variableDefinitions  +=  this . INDENT  +  "self.mechanisms = []\n" ; 
8168    } 
8269
83-     Object . entries ( this . mapComponentNameToVarName ) . forEach ( ( [ componentName ,  varName ] )  =>  { 
84-       variableDefinitions  +=  this . INDENT  +  'self.'  +  varName  +  ' = robot.'  +  componentName  +  '\n' ; 
85-     } ) ; 
86- 
8770    return  variableDefinitions ; 
8871  } 
8972  getVariableName ( nameOrId : string ) : string  { 
@@ -120,13 +103,6 @@ export class ExtendedPythonGenerator extends PythonGenerator {
120103    this . classMethods [ methodName ]  =  code ; 
121104  } 
122105
123-   /** 
124-    * Get the variable name to use for a component. 
125-    */ 
126-   componentNameToVarName ( componentName : string ) : string  { 
127-     return  this . mapComponentNameToVarName [ componentName ] ; 
128-   } 
129- 
130106  finish ( code : string ) : string  { 
131107    if  ( this . context  &&  this . workspace )  { 
132108      const  className  =  this . context . getClassName ( ) ; 
@@ -143,8 +119,6 @@ export class ExtendedPythonGenerator extends PythonGenerator {
143119      this . context . setExportedBlocks ( this . produceExportedBlocks ( this . workspace ) ) ; 
144120    } 
145121
146-     this . mapComponentNameToVarName  =  Object . create ( null ) ; 
147- 
148122    return  super . finish ( code ) ; 
149123  } 
150124
0 commit comments