public override void VisitConversionExpression(IConversionExpression operation)
        {
            var usesOperatorMethod = operation.UsesOperatorMethod;
            var operatorMethod     = operation.OperatorMethod;
            var conversion         = operation.Conversion;
            var isExplicitInCode   = operation.IsExplicitInCode;
            var isChecked          = operation.IsChecked;
            var isTryCast          = operation.IsTryCast;

            switch (operation.Language)
            {
            case LanguageNames.CSharp:
                CSharp.Conversion csharpConversion = CSharp.CSharpExtensions.GetConversion(operation);
                break;

            case LanguageNames.VisualBasic:
                VisualBasic.Conversion visualBasicConversion = VisualBasic.VisualBasicExtensions.GetConversion(operation);
                break;

            default:
                Debug.Fail($"Language {operation.Language} is unknown!");
                break;
            }

            base.VisitConversionExpression(operation);
        }
Example #2
0
        public override void VisitConversion(IConversionOperation operation)
        {
            Assert.Equal(OperationKind.Conversion, operation.Kind);
            var operatorMethod = operation.OperatorMethod;
            var conversion     = operation.Conversion;
            var isChecked      = operation.IsChecked;
            var isTryCast      = operation.IsTryCast;

            switch (operation.Language)
            {
            case LanguageNames.CSharp:
                CSharp.Conversion csharpConversion = CSharp.CSharpExtensions.GetConversion(operation);
                break;

            case LanguageNames.VisualBasic:
                VisualBasic.Conversion visualBasicConversion = VisualBasic.VisualBasicExtensions.GetConversion(operation);
                break;

            default:
                Debug.Fail($"Language {operation.Language} is unknown!");
                break;
            }

            Assert.Same(operation.Operand, operation.Children.Single());
        }