@ Override protected PyExpr visitCallDelegateNode ( CallDelegateNode node ) { ExprRootNode variantSoyExpr = node . getDelCalleeVariantExpr ( ) ; PyExpr variantPyExpr ; if ( variantSoyExpr == null ) { // Case 1: Delegate call with empty variant. variantPyExpr = new PyStringExpr ( "''" ) ; } else { // Case 2: Delegate call with variant expression. TranslateToPyExprVisitor translator = new TranslateToPyExprVisitor ( localVarStack , pluginValueFactory , errorReporter ) ; variantPyExpr = translator . exec ( variantSoyExpr ) ; } String calleeExprText = new PyFunctionExprBuilder ( "runtime.get_delegate_fn" ) . addArg ( node . getDelCalleeName ( ) ) . addArg ( variantPyExpr ) . addArg ( node . allowEmptyDefault ( ) ) . build ( ) ; String callExprText = calleeExprText + "(" + genObjToPass ( node ) + ", ijData)" ; return escapeCall ( callExprText , node . getEscapingDirectives ( ) ) ; }
Visits a delegate call node and builds the call expression to retrieve the function and execute it . The get_delegate_fn returns the function directly so its output can be called directly .