@@ -37,6 +37,7 @@ const FUNCTION_KIND_MODULE = 'module';
3737const FUNCTION_KIND_STATIC = 'static' ;
3838const FUNCTION_KIND_CONSTRUCTOR = 'constructor' ;
3939const FUNCTION_KIND_INSTANCE = 'instance' ;
40+ const FUNCTION_KIND_INSTANCE_WITHIN = 'instance_within' ;
4041
4142const RETURN_TYPE_NONE = 'None' ;
4243
@@ -127,6 +128,11 @@ const CALL_PYTHON_FUNCTION = {
127128 tooltip = 'Calls the function ' + className + '.' + functionName + '.' ;
128129 break ;
129130 }
131+ case FUNCTION_KIND_INSTANCE_WITHIN : {
132+ const functionName = this . getFieldValue ( pythonUtils . FIELD_FUNCTION_NAME ) ;
133+ tooltip = 'Calls the method ' + functionName + '.' ;
134+ break ;
135+ }
130136 default :
131137 throw new Error ( 'mrcVarKind must be "module", "static", "constructor", or "instance".' )
132138 }
@@ -238,6 +244,11 @@ const CALL_PYTHON_FUNCTION = {
238244 . appendField ( '.' )
239245 . appendField ( createFieldNonEditableText ( '' ) , pythonUtils . FIELD_FUNCTION_NAME ) ;
240246 break ;
247+ case FUNCTION_KIND_INSTANCE_WITHIN :
248+ this . appendDummyInput ( )
249+ . appendField ( 'call' )
250+ . appendField ( createFieldNonEditableText ( '' ) , pythonUtils . FIELD_FUNCTION_NAME ) ;
251+ break ;
241252 default :
242253 throw new Error ( 'mrcVarKind must be "module", "static", "constructor", or "instance".' )
243254 }
@@ -301,6 +312,14 @@ export const pythonFromBlock = function(
301312 argStartIndex = 1 ; // Skip the self argument.
302313 break ;
303314 }
315+ case FUNCTION_KIND_INSTANCE_WITHIN : {
316+ const callPythonFunctionBlock = block as CallPythonFunctionBlock ;
317+ const functionName = ( callPythonFunctionBlock . mrcActualFunctionName )
318+ ? callPythonFunctionBlock . mrcActualFunctionName
319+ : block . getFieldValue ( pythonUtils . FIELD_FUNCTION_NAME ) ;
320+ code = 'self.' + functionName ;
321+ break ;
322+ }
304323 }
305324 code += '(' + generateCodeForArguments ( callPythonFunctionBlock , generator , argStartIndex ) + ')' ;
306325 if ( block . outputConnection ) {
0 commit comments