Пример #1
0
 public BuiltInVisualBasicOperatorSubstitutions(CommentConvertingVisitorWrapper triviaConvertingVisitor, SemanticModel semanticModel, VisualBasicEqualityComparison visualBasicEqualityComparison, TypeConversionAnalyzer typeConversionAnalyzer)
 {
     _semanticModel = semanticModel;
     _visualBasicEqualityComparison = visualBasicEqualityComparison;
     _triviaConvertingVisitor       = triviaConvertingVisitor;
     _typeConversionAnalyzer        = typeConversionAnalyzer;
 }
Пример #2
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)));
        }
Пример #3
0
 public CommonConversions(Document document, SemanticModel semanticModel,
                          TypeConversionAnalyzer typeConversionAnalyzer, SyntaxGenerator csSyntaxGenerator,
                          Compilation compilation,
                          CSharpCompilation csCompilation, ITypeContext typeContext, VisualBasicEqualityComparison visualBasicEqualityComparison)
 {
     TypeConversionAnalyzer = typeConversionAnalyzer;
     Document                      = document;
     SemanticModel                 = semanticModel;
     CsSyntaxGenerator             = csSyntaxGenerator;
     Compilation                   = compilation;
     _csCompilation                = csCompilation;
     _typeContext                  = typeContext;
     VisualBasicEqualityComparison = visualBasicEqualityComparison;
     WinformsConversions           = new WinformsConversions(typeContext);
 }
Пример #4
0
 public ExpressionEvaluator(SemanticModel semanticModel, VisualBasicEqualityComparison visualBasicEqualityComparison)
 {
     _semanticModel = semanticModel;
     _visualBasicEqualityComparison = visualBasicEqualityComparison;
 }
Пример #5
0
 public static IOperatorConverter Create(CommentConvertingVisitorWrapper expressionVisitor, SemanticModel semanticModel, VisualBasicEqualityComparison visualBasicEqualityComparison, TypeConversionAnalyzer typeConversionAnalyzer)
 {
     return(new BuiltInVisualBasicOperatorSubstitutions(expressionVisitor, semanticModel, visualBasicEqualityComparison, typeConversionAnalyzer));
 }