public static bool ApplyFunctionBindToCorrectContext(ExpressionTranslation exp) { if (exp == null || exp.Syntax == null) { return(false); } var semanticModel = exp.GetSemanticModel(); if (semanticModel == null) { return(false); } var identifierName = exp as IdentifierNameTranslation; if (identifierName != null) { var symbol = semanticModel.GetSymbolInfo(exp.Syntax); var method = symbol.Symbol as IMethodSymbol; if (method == null || method.IsStatic) { return(false); } identifierName.MethodNeedToBind = "this"; return(true); } var memberAccess = exp as MemberAccessExpressionTranslation; if (memberAccess != null && memberAccess.Name is IdentifierNameTranslation) { var symbol = semanticModel.GetSymbolInfo(memberAccess.Name.Syntax); var method = symbol.Symbol as IMethodSymbol; if (method == null || method.IsStatic) { return(false); } ((IdentifierNameTranslation)memberAccess.Name).MethodNeedToBind = memberAccess.Expression.Translate(); return(true); } return(false); }