public static boolean buildCallReceiver ( XAbstractFeatureCall call , Function0 < ? extends String > thisKeyword , Function1 < ? super XExpression , ? extends String > referenceNameDefinition , List < Object > output ) { if ( call . isStatic ( ) ) { if ( call instanceof XMemberFeatureCall ) { final XMemberFeatureCall memberFeatureCall = ( XMemberFeatureCall ) call ; if ( memberFeatureCall . isStaticWithDeclaringType ( ) ) { final XAbstractFeatureCall target = ( XAbstractFeatureCall ) memberFeatureCall . getMemberCallTarget ( ) ; final JvmType declaringType = ( JvmType ) target . getFeature ( ) ; output . add ( declaringType ) ; return true ; } } output . add ( ( ( JvmFeature ) call . getFeature ( ) ) . getDeclaringType ( ) ) ; return true ; } final XExpression receiver = call . getActualReceiver ( ) ; if ( receiver == null ) { return false ; } final XExpression implicit = call . getImplicitReceiver ( ) ; if ( receiver == implicit ) { output . add ( thisKeyword . apply ( ) ) ; } else { output . add ( receiver ) ; if ( receiver instanceof XAbstractFeatureCall ) { // some local types have a reference name bound to the empty string // which is the reason why we have to check for an empty string as a valid // reference name here // see AnonymousClassCompilerTest.testCapturedLocalVar_04 // if it turns out that we have to deal with generics there too, we may // have to create a field in the synthesized local class with a unique // name that points to 'this' if ( ( ( XAbstractFeatureCall ) receiver ) . getFeature ( ) instanceof JvmType ) { final String referenceName = referenceNameDefinition . apply ( receiver ) ; if ( referenceName != null && referenceName . length ( ) == 0 ) { return false ; } } } } return true ; }
Compute the list of object that serve as the receiver for the given call .