public BuiltInVisualBasicOperatorSubstitutions(CommentConvertingVisitorWrapper triviaConvertingVisitor, SemanticModel semanticModel, VisualBasicEqualityComparison visualBasicEqualityComparison, TypeConversionAnalyzer typeConversionAnalyzer)
 {
     _semanticModel = semanticModel;
     _visualBasicEqualityComparison = visualBasicEqualityComparison;
     _triviaConvertingVisitor       = triviaConvertingVisitor;
     _typeConversionAnalyzer        = typeConversionAnalyzer;
 }
Beispiel #2
0
 public TypeConversionAnalyzer(SemanticModel semanticModel, CSharpCompilation csCompilation,
                               HashSet <string> extraUsingDirectives, SyntaxGenerator csSyntaxGenerator, VisualBasicEqualityComparison visualBasicEqualityComparison)
 {
     _semanticModel                 = semanticModel;
     _csCompilation                 = csCompilation;
     _extraUsingDirectives          = extraUsingDirectives;
     _csSyntaxGenerator             = csSyntaxGenerator;
     _visualBasicEqualityComparison = visualBasicEqualityComparison;
 }
 public CommonConversions(Document document, SemanticModel semanticModel,
                          TypeConversionAnalyzer typeConversionAnalyzer, SyntaxGenerator csSyntaxGenerator,
                          CSharpCompilation csCompilation, ITypeContext typeContext, VisualBasicEqualityComparison visualBasicEqualityComparison)
 {
     TypeConversionAnalyzer = typeConversionAnalyzer;
     Document                      = document;
     _semanticModel                = semanticModel;
     CsSyntaxGenerator             = csSyntaxGenerator;
     _csCompilation                = csCompilation;
     _typeContext                  = typeContext;
     VisualBasicEqualityComparison = visualBasicEqualityComparison;
 }
Beispiel #4
0
            private async Task <ExpressionSyntax> ConvertToStringComparisonOperatorAsync(VBSyntax.BinaryExpressionSyntax node, SyntaxKind expressionKind)
            {
                var(lhs, rhs) = await AcceptSidesAsync(node);

                lhs = VisualBasicEqualityComparison.VbCoerceToString(lhs, _semanticModel.GetTypeInfo(node.Left));
                rhs = VisualBasicEqualityComparison.VbCoerceToString(rhs, _semanticModel.GetTypeInfo(node.Right));
                var member = new KnownMethod(_compilerServices, _operators, "CompareString");
                var optionaCompareTextBoolLiteralExpression = _visualBasicEqualityComparison.OptionCompareTextCaseInsensitiveBoolExpression;
                var comparedLhs = member.Invoke(_visualBasicEqualityComparison.ExtraUsingDirectives, lhs, rhs, optionaCompareTextBoolLiteralExpression);

                return(SyntaxFactory.BinaryExpression(expressionKind, comparedLhs, LiteralConversions.GetLiteralExpression(0)));
            }
 public static IOperatorConverter Create(CommentConvertingVisitorWrapper expressionVisitor, SemanticModel semanticModel, VisualBasicEqualityComparison visualBasicEqualityComparison, TypeConversionAnalyzer typeConversionAnalyzer)
 {
     return(new BuiltInVisualBasicOperatorSubstitutions(expressionVisitor, semanticModel, visualBasicEqualityComparison, typeConversionAnalyzer));
 }
 public ExpressionEvaluator(SemanticModel semanticModel, VisualBasicEqualityComparison visualBasicEqualityComparison)
 {
     _semanticModel = semanticModel;
     _visualBasicEqualityComparison = visualBasicEqualityComparison;
 }