提交 28cdbd97 编写于 作者: M Manish Vasani

Address PR feedback

1. Add IsChecked flag for IIncrementExpression and ICompoundAssignmentExpression
2. Add back VB specific binary operator kinds
3. Add more unit tests and fix baselines of existing tests
上级 c7a75ef1
......@@ -778,12 +778,14 @@ private ICompoundAssignmentExpression CreateBoundCompoundAssignmentOperatorOpera
BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind(boundCompoundAssignmentOperator.Operator.Kind);
Lazy<IOperation> target = new Lazy<IOperation>(() => Create(boundCompoundAssignmentOperator.Left));
Lazy<IOperation> value = new Lazy<IOperation>(() => Create(boundCompoundAssignmentOperator.Right));
bool isLifted = boundCompoundAssignmentOperator.Type.IsNullableType();
bool isChecked = boundCompoundAssignmentOperator.Operator.Kind.IsChecked();
bool usesOperatorMethod = (boundCompoundAssignmentOperator.Operator.Kind & CSharp.BinaryOperatorKind.TypeMask) == CSharp.BinaryOperatorKind.UserDefined;
IMethodSymbol operatorMethod = boundCompoundAssignmentOperator.Operator.Method;
SyntaxNode syntax = boundCompoundAssignmentOperator.Syntax;
ITypeSymbol type = boundCompoundAssignmentOperator.Type;
Optional<object> constantValue = ConvertToOptional(boundCompoundAssignmentOperator.ConstantValue);
return new LazyCompoundAssignmentExpression(operatorKind, boundCompoundAssignmentOperator.Type.IsNullableType(), target, value, usesOperatorMethod, operatorMethod, _semanticModel, syntax, type, constantValue);
return new LazyCompoundAssignmentExpression(operatorKind, isLifted, isChecked, target, value, usesOperatorMethod, operatorMethod, _semanticModel, syntax, type, constantValue);
}
private IIncrementExpression CreateBoundIncrementOperatorOperation(BoundIncrementOperator boundIncrementOperator)
......@@ -791,13 +793,14 @@ private IIncrementExpression CreateBoundIncrementOperatorOperation(BoundIncremen
bool isDecrement = Helper.IsDecrement(boundIncrementOperator.OperatorKind);
bool isPostfix = Helper.IsPostfixIncrementOrDecrement(boundIncrementOperator.OperatorKind);
bool isLifted = boundIncrementOperator.OperatorKind.IsLifted();
bool isChecked = boundIncrementOperator.OperatorKind.IsChecked();
Lazy<IOperation> target = new Lazy<IOperation>(() => Create(boundIncrementOperator.Operand));
bool usesOperatorMethod = (boundIncrementOperator.OperatorKind & CSharp.UnaryOperatorKind.TypeMask) == CSharp.UnaryOperatorKind.UserDefined;
IMethodSymbol operatorMethod = boundIncrementOperator.MethodOpt;
SyntaxNode syntax = boundIncrementOperator.Syntax;
ITypeSymbol type = boundIncrementOperator.Type;
Optional<object> constantValue = ConvertToOptional(boundIncrementOperator.ConstantValue);
return new LazyIncrementExpression(isDecrement, isPostfix, isLifted, target, usesOperatorMethod, operatorMethod, _semanticModel, syntax, type, constantValue);
return new LazyIncrementExpression(isDecrement, isPostfix, isLifted, isChecked, target, usesOperatorMethod, operatorMethod, _semanticModel, syntax, type, constantValue);
}
private IInvalidExpression CreateBoundBadExpressionOperation(BoundBadExpression boundBadExpression)
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
......
......@@ -679,7 +679,7 @@ internal abstract partial class BaseBinaryOperatorExpression : Operation, IHasOp
/// </summary>
public bool IsLifted { get; }
/// <summary>
/// <code>true</code> if this is a 'checked' binary operator.
/// <code>true</code> if this is overflow checking is performed for the arithmetic operation.
/// </summary>
public bool IsChecked { get; }
/// <summary>
......@@ -957,11 +957,12 @@ public LazyCatchClause(Lazy<IBlockStatement> handler, ITypeSymbol caughtType, La
/// </summary>
internal abstract partial class BaseCompoundAssignmentExpression : AssignmentExpression, IHasOperatorMethodExpression, ICompoundAssignmentExpression
{
protected BaseCompoundAssignmentExpression(BinaryOperatorKind operatorKind, bool isLifted, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
protected BaseCompoundAssignmentExpression(BinaryOperatorKind operatorKind, bool isLifted, bool isChecked, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
base(OperationKind.CompoundAssignmentExpression, semanticModel, syntax, type, constantValue)
{
OperatorKind = operatorKind;
IsLifted = isLifted;
IsChecked = isChecked;
UsesOperatorMethod = usesOperatorMethod;
OperatorMethod = operatorMethod;
}
......@@ -974,6 +975,10 @@ internal abstract partial class BaseCompoundAssignmentExpression : AssignmentExp
/// </summary>
public bool IsLifted { get; }
/// <summary>
/// <code>true</code> if this is overflow checking is performed for the arithmetic operation.
/// </summary>
public bool IsChecked { get; }
/// <summary>
/// True if and only if the operation is performed by an operator method.
/// </summary>
public bool UsesOperatorMethod { get; }
......@@ -1005,8 +1010,8 @@ public override void Accept(OperationVisitor visitor)
/// </summary>
internal sealed partial class CompoundAssignmentExpression : BaseCompoundAssignmentExpression, IHasOperatorMethodExpression, ICompoundAssignmentExpression
{
public CompoundAssignmentExpression(BinaryOperatorKind operatorKind, bool isLifted, IOperation target, IOperation value, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
base(operatorKind, isLifted, usesOperatorMethod, operatorMethod, semanticModel, syntax, type, constantValue)
public CompoundAssignmentExpression(BinaryOperatorKind operatorKind, bool isLifted, bool isChecked, IOperation target, IOperation value, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
base(operatorKind, isLifted, isChecked, usesOperatorMethod, operatorMethod, semanticModel, syntax, type, constantValue)
{
TargetImpl = target;
ValueImpl = value;
......@@ -1023,8 +1028,8 @@ internal sealed partial class LazyCompoundAssignmentExpression : BaseCompoundAss
private readonly Lazy<IOperation> _lazyTarget;
private readonly Lazy<IOperation> _lazyValue;
public LazyCompoundAssignmentExpression(BinaryOperatorKind operatorKind, bool isLifted, Lazy<IOperation> target, Lazy<IOperation> value, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
base(operatorKind, isLifted, usesOperatorMethod, operatorMethod, semanticModel, syntax, type, constantValue)
public LazyCompoundAssignmentExpression(BinaryOperatorKind operatorKind, bool isLifted, bool isChecked, Lazy<IOperation> target, Lazy<IOperation> value, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
base(operatorKind, isLifted, isChecked, usesOperatorMethod, operatorMethod, semanticModel, syntax, type, constantValue)
{
_lazyTarget = target ?? throw new System.ArgumentNullException(nameof(target));
_lazyValue = value ?? throw new System.ArgumentNullException(nameof(value));
......@@ -2015,12 +2020,13 @@ public LazyIfStatement(Lazy<IOperation> condition, Lazy<IOperation> ifTrueStatem
/// </summary>
internal abstract partial class BaseIncrementExpression : Operation, IIncrementExpression
{
public BaseIncrementExpression(bool isDecrement, bool isPostfix, bool isLifted, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
public BaseIncrementExpression(bool isDecrement, bool isPostfix, bool isLifted, bool isChecked, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
base(OperationKind.IncrementExpression, semanticModel, syntax, type, constantValue)
{
IsDecrement = isDecrement;
IsPostfix = isPostfix;
IsLifted = isLifted;
IsChecked = isChecked;
UsesOperatorMethod = usesOperatorMethod;
OperatorMethod = operatorMethod;
}
......@@ -2041,6 +2047,10 @@ internal abstract partial class BaseIncrementExpression : Operation, IIncrementE
/// value types.
/// </summary>
public bool IsLifted { get; }
/// <summary>
/// <code>true</code> if this is overflow checking is performed for the arithmetic operation.
/// </summary>
public bool IsChecked { get; }
protected abstract IOperation TargetImpl { get; }
/// <summary>
/// True if and only if the operation is performed by an operator method.
......@@ -2077,8 +2087,8 @@ public override void Accept(OperationVisitor visitor)
/// </summary>
internal sealed partial class IncrementExpression : BaseIncrementExpression, IIncrementExpression
{
public IncrementExpression(bool isDecrement, bool isPostfix, bool isLifted, IOperation target, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
base(isDecrement, isPostfix, isLifted, usesOperatorMethod, operatorMethod, semanticModel, syntax, type, constantValue)
public IncrementExpression(bool isDecrement, bool isPostfix, bool isLifted, bool isChecked, IOperation target, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
base(isDecrement, isPostfix, isLifted, isChecked, usesOperatorMethod, operatorMethod, semanticModel, syntax, type, constantValue)
{
TargetImpl = target;
}
......@@ -2093,8 +2103,8 @@ internal sealed partial class LazyIncrementExpression : BaseIncrementExpression,
{
private readonly Lazy<IOperation> _lazyTarget;
public LazyIncrementExpression(bool isDecrement, bool isPostfix, bool isLifted, Lazy<IOperation> target, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
base(isDecrement, isPostfix, isLifted, usesOperatorMethod, operatorMethod, semanticModel, syntax, type, constantValue)
public LazyIncrementExpression(bool isDecrement, bool isPostfix, bool isLifted, bool isChecked, Lazy<IOperation> target, bool usesOperatorMethod, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
base(isDecrement, isPostfix, isLifted, isChecked, usesOperatorMethod, operatorMethod, semanticModel, syntax, type, constantValue)
{
_lazyTarget = target ?? throw new System.ArgumentNullException(nameof(target));
}
......@@ -4733,7 +4743,7 @@ internal abstract partial class BaseUnaryOperatorExpression : Operation, IHasOpe
/// </summary>
public bool IsLifted { get; }
/// <summary>
/// <code>true</code> if this is a 'checked' binary operator.
/// <code>true</code> if this is overflow checking is performed for the arithmetic operation.
/// </summary>
public bool IsChecked { get; }
public override IEnumerable<IOperation> Children
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
......@@ -17,9 +15,15 @@ public interface ICompoundAssignmentExpression : IAssignmentExpression, IHasOper
/// Kind of binary operation.
/// </summary>
BinaryOperatorKind OperatorKind { get; }
/// <summary>
/// <code>true</code> if this assignment contains a 'lifted' binary operation.
/// </summary>
bool IsLifted { get; }
/// <summary>
/// <code>true</code> if this is overflow checking is performed for the arithmetic operation.
/// </summary>
bool IsChecked { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
......@@ -37,6 +35,11 @@ public interface IIncrementExpression : IOperation, IHasOperatorMethodExpression
/// value types.
/// </summary>
bool IsLifted { get; }
/// <summary>
/// <code>true</code> if this is overflow checking is performed for the arithmetic operation.
/// </summary>
bool IsChecked { get; }
}
}
......@@ -31,7 +31,7 @@ public interface IUnaryOperatorExpression : IHasOperatorMethodExpression
bool IsLifted { get; }
/// <summary>
/// <code>true</code> if this is a 'checked' binary operator.
/// <code>true</code> if this is overflow checking is performed for the arithmetic operation.
/// </summary>
bool IsChecked { get; }
}
......
......@@ -381,12 +381,12 @@ public override IOperation VisitSimpleAssignmentExpression(ISimpleAssignmentExpr
public override IOperation VisitCompoundAssignmentExpression(ICompoundAssignmentExpression operation, object argument)
{
return new CompoundAssignmentExpression(operation.OperatorKind, operation.IsLifted, Visit(operation.Target), Visit(operation.Value), operation.UsesOperatorMethod, operation.OperatorMethod, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue);
return new CompoundAssignmentExpression(operation.OperatorKind, operation.IsLifted, operation.IsChecked, Visit(operation.Target), Visit(operation.Value), operation.UsesOperatorMethod, operation.OperatorMethod, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue);
}
public override IOperation VisitIncrementExpression(IIncrementExpression operation, object argument)
{
return new IncrementExpression(operation.IsDecrement, operation.IsPostfix, operation.IsLifted, Visit(operation.Target), operation.UsesOperatorMethod, operation.OperatorMethod, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue);
return new IncrementExpression(operation.IsDecrement, operation.IsPostfix, operation.IsLifted, operation.IsChecked, Visit(operation.Target), operation.UsesOperatorMethod, operation.OperatorMethod, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue);
}
public override IOperation VisitParenthesizedExpression(IParenthesizedExpression operation, object argument)
......
......@@ -42,11 +42,12 @@ public static IExpressionStatement CreateSimpleAssignmentExpressionStatement(IOp
}
public static IExpressionStatement CreateCompoundAssignmentExpressionStatement(
IOperation target, IOperation value, BinaryOperatorKind operatorKind, bool isLifted, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax)
IOperation target, IOperation value, BinaryOperatorKind operatorKind, bool isLifted, bool isChecked, IMethodSymbol operatorMethod, SemanticModel semanticModel, SyntaxNode syntax)
{
var expression = new CompoundAssignmentExpression(
operatorKind,
isLifted,
isChecked,
target,
value,
operatorMethod != null,
......
......@@ -245,6 +245,7 @@ Microsoft.CodeAnalysis.Semantics.ICollectionElementInitializerExpression.AddMeth
Microsoft.CodeAnalysis.Semantics.ICollectionElementInitializerExpression.Arguments.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.IOperation>
Microsoft.CodeAnalysis.Semantics.ICollectionElementInitializerExpression.IsDynamic.get -> bool
Microsoft.CodeAnalysis.Semantics.ICompoundAssignmentExpression
Microsoft.CodeAnalysis.Semantics.ICompoundAssignmentExpression.IsChecked.get -> bool
Microsoft.CodeAnalysis.Semantics.ICompoundAssignmentExpression.IsLifted.get -> bool
Microsoft.CodeAnalysis.Semantics.ICompoundAssignmentExpression.OperatorKind.get -> Microsoft.CodeAnalysis.Semantics.BinaryOperatorKind
Microsoft.CodeAnalysis.Semantics.IConditionalAccessExpression
......@@ -317,6 +318,7 @@ Microsoft.CodeAnalysis.Semantics.IIfStatement.Condition.get -> Microsoft.CodeAna
Microsoft.CodeAnalysis.Semantics.IIfStatement.IfFalseStatement.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IIfStatement.IfTrueStatement.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IIncrementExpression
Microsoft.CodeAnalysis.Semantics.IIncrementExpression.IsChecked.get -> bool
Microsoft.CodeAnalysis.Semantics.IIncrementExpression.IsDecrement.get -> bool
Microsoft.CodeAnalysis.Semantics.IIncrementExpression.IsLifted.get -> bool
Microsoft.CodeAnalysis.Semantics.IIncrementExpression.IsPostfix.get -> bool
......
......@@ -272,7 +272,9 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim syntax As SyntaxNode = boundAssignmentOperator.Syntax
Dim type As ITypeSymbol = boundAssignmentOperator.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundAssignmentOperator.ConstantValueOpt)
Return New LazyCompoundAssignmentExpression(operatorKind, boundAssignmentOperator.Type.IsNullableType(), target, value, usesOperatorMethod, operatorMethod, _semanticModel, syntax, type, constantValue)
Dim isLifted As Boolean = boundAssignmentOperator.Type.IsNullableType()
Dim isChecked As Boolean = False
Return New LazyCompoundAssignmentExpression(operatorKind, isLifted, isChecked, target, value, usesOperatorMethod, operatorMethod, _semanticModel, syntax, type, constantValue)
Else
Dim target As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundAssignmentOperator.Left))
Dim value As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundAssignmentOperator.Right))
......@@ -395,8 +397,8 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim syntax As SyntaxNode = boundUnaryOperator.Syntax
Dim type As ITypeSymbol = boundUnaryOperator.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundUnaryOperator.ConstantValueOpt)
Dim isLifted = (boundUnaryOperator.OperatorKind And VisualBasic.UnaryOperatorKind.Lifted) <> 0
Dim isChecked = boundUnaryOperator.Checked
Dim isLifted As Boolean = (boundUnaryOperator.OperatorKind And VisualBasic.UnaryOperatorKind.Lifted) <> 0
Dim isChecked As Boolean = boundUnaryOperator.Checked
Return New LazyUnaryOperatorExpression(operatorKind, operand, isLifted, isChecked, usesOperatorMethod, operatorMethod, _semanticModel, syntax, type, constantValue)
End Function
......@@ -414,13 +416,13 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim syntax As SyntaxNode = boundUserDefinedUnaryOperator.Syntax
Dim type As ITypeSymbol = boundUserDefinedUnaryOperator.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundUserDefinedUnaryOperator.ConstantValueOpt)
Dim isLifted = (boundUserDefinedUnaryOperator.OperatorKind And VisualBasic.UnaryOperatorKind.Lifted) <> 0
Dim isChecked = False
Dim isLifted As Boolean = (boundUserDefinedUnaryOperator.OperatorKind And VisualBasic.UnaryOperatorKind.Lifted) <> 0
Dim isChecked As Boolean = False
Return New LazyUnaryOperatorExpression(operatorKind, operand, isLifted, isChecked, usesOperatorMethod, operatorMethod, _semanticModel, syntax, type, constantValue)
End Function
Private Function CreateBoundBinaryOperatorOperation(boundBinaryOperator As BoundBinaryOperator) As IBinaryOperatorExpression
Dim operatorKind As BinaryOperatorKind = Helper.DeriveBinaryOperatorKind(boundBinaryOperator.OperatorKind)
Dim operatorKind As BinaryOperatorKind = Helper.DeriveBinaryOperatorKind(boundBinaryOperator.OperatorKind, boundBinaryOperator.Left)
Dim leftOperand As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundBinaryOperator.Left))
Dim rightOperand As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundBinaryOperator.Right))
Dim usesOperatorMethod As Boolean = False
......@@ -428,14 +430,14 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim syntax As SyntaxNode = boundBinaryOperator.Syntax
Dim type As ITypeSymbol = boundBinaryOperator.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundBinaryOperator.ConstantValueOpt)
Dim isLifted = (boundBinaryOperator.OperatorKind And VisualBasic.BinaryOperatorKind.Lifted) <> 0
Dim isChecked = boundBinaryOperator.Checked
Dim isCompareText = (boundBinaryOperator.OperatorKind And VisualBasic.BinaryOperatorKind.CompareText) <> 0
Dim isLifted As Boolean = (boundBinaryOperator.OperatorKind And VisualBasic.BinaryOperatorKind.Lifted) <> 0
Dim isChecked As Boolean = boundBinaryOperator.Checked
Dim isCompareText As Boolean = (boundBinaryOperator.OperatorKind And VisualBasic.BinaryOperatorKind.CompareText) <> 0
Return New LazyBinaryOperatorExpression(operatorKind, leftOperand, rightOperand, isLifted, isChecked, isCompareText, usesOperatorMethod, operatorMethod, _semanticModel, syntax, type, constantValue)
End Function
Private Function CreateBoundUserDefinedBinaryOperatorOperation(boundUserDefinedBinaryOperator As BoundUserDefinedBinaryOperator) As IBinaryOperatorExpression
Dim operatorKind As BinaryOperatorKind = Helper.DeriveBinaryOperatorKind(boundUserDefinedBinaryOperator.OperatorKind)
Dim operatorKind As BinaryOperatorKind = Helper.DeriveBinaryOperatorKind(boundUserDefinedBinaryOperator.OperatorKind, leftOpt:=Nothing)
Dim leftOperand As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() GetUserDefinedBinaryOperatorChild(boundUserDefinedBinaryOperator, 0))
Dim rightOperand As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() GetUserDefinedBinaryOperatorChild(boundUserDefinedBinaryOperator, 1))
Dim operatorMethod As IMethodSymbol = If(boundUserDefinedBinaryOperator.UnderlyingExpression.Kind = BoundKind.Call, boundUserDefinedBinaryOperator.Call.Method, Nothing)
......@@ -443,9 +445,9 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim syntax As SyntaxNode = boundUserDefinedBinaryOperator.Syntax
Dim type As ITypeSymbol = boundUserDefinedBinaryOperator.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundUserDefinedBinaryOperator.ConstantValueOpt)
Dim isLifted = (boundUserDefinedBinaryOperator.OperatorKind And VisualBasic.BinaryOperatorKind.Lifted) <> 0
Dim isChecked = boundUserDefinedBinaryOperator.Checked
Dim isCompareText = (boundUserDefinedBinaryOperator.OperatorKind And VisualBasic.BinaryOperatorKind.CompareText) <> 0
Dim isLifted As Boolean = (boundUserDefinedBinaryOperator.OperatorKind And VisualBasic.BinaryOperatorKind.Lifted) <> 0
Dim isChecked As Boolean = boundUserDefinedBinaryOperator.Checked
Dim isCompareText As Boolean = False
Return New LazyBinaryOperatorExpression(operatorKind, leftOperand, rightOperand, isLifted, isChecked, isCompareText, usesOperatorMethod, operatorMethod, _semanticModel, syntax, type, constantValue)
End Function
......@@ -467,9 +469,9 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim syntax As SyntaxNode = boundUserDefinedShortCircuitingOperator.Syntax
Dim type As ITypeSymbol = boundUserDefinedShortCircuitingOperator.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundUserDefinedShortCircuitingOperator.ConstantValueOpt)
Dim isLifted = (boundUserDefinedShortCircuitingOperator.BitwiseOperator.OperatorKind And VisualBasic.BinaryOperatorKind.Lifted) <> 0
Dim isChecked = False
Dim isCompareText = False
Dim isLifted As Boolean = (boundUserDefinedShortCircuitingOperator.BitwiseOperator.OperatorKind And VisualBasic.BinaryOperatorKind.Lifted) <> 0
Dim isChecked As Boolean = False
Dim isCompareText As Boolean = False
Return New LazyBinaryOperatorExpression(operatorKind, leftOperand, rightOperand, isLifted, isChecked, isCompareText, usesOperatorMethod, operatorMethod, _semanticModel, syntax, type, constantValue)
End Function
......@@ -487,7 +489,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim conversion As Conversion = _semanticModel.GetConversion(syntax)
Dim isExplicitCastInCode As Boolean = True
Dim isTryCast As Boolean = True
Dim isChecked = False
Dim isChecked As Boolean = False
Dim type As ITypeSymbol = boundTryCast.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundTryCast.ConstantValueOpt)
Return New LazyVisualBasicConversionExpression(operand, conversion, isExplicitCastInCode, isTryCast, isChecked, _semanticModel, syntax, type, constantValue)
......@@ -499,7 +501,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim conversion As Conversion = _semanticModel.GetConversion(syntax)
Dim isExplicit As Boolean = True
Dim isTryCast As Boolean = False
Dim isChecked = False
Dim isChecked As Boolean = False
Dim type As ITypeSymbol = boundDirectCast.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundDirectCast.ConstantValueOpt)
Return New LazyVisualBasicConversionExpression(operand, conversion, isExplicit, isTryCast, isChecked, _semanticModel, syntax, type, constantValue)
......@@ -511,7 +513,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim conversion As Conversion = _semanticModel.GetConversion(syntax)
Dim isExplicit As Boolean = boundConversion.ExplicitCastInCode
Dim isTryCast As Boolean = False
Dim isChecked = False
Dim isChecked As Boolean = False
Dim type As ITypeSymbol = boundConversion.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundConversion.ConstantValueOpt)
Return New LazyVisualBasicConversionExpression(operand, conversion, isExplicit, isTryCast, isChecked, _semanticModel, syntax, type, constantValue)
......@@ -523,7 +525,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim conversion As Conversion = _semanticModel.GetConversion(syntax)
Dim isExplicit As Boolean = Not boundUserDefinedConversion.WasCompilerGenerated
Dim isTryCast As Boolean = False
Dim isChecked = False
Dim isChecked As Boolean = False
Dim type As ITypeSymbol = boundUserDefinedConversion.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundUserDefinedConversion.ConstantValueOpt)
Return New LazyVisualBasicConversionExpression(operand, conversion, isExplicit, isTryCast, isChecked, _semanticModel, syntax, type, constantValue)
......@@ -846,7 +848,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
Private Function CreateBoundRelationalCaseClauseOperation(boundRelationalCaseClause As BoundRelationalCaseClause) As IRelationalCaseClause
Dim valueExpression = GetRelationalCaseClauseValue(boundRelationalCaseClause)
Dim value As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(valueExpression))
Dim relation As BinaryOperatorKind = If(valueExpression IsNot Nothing, Helper.DeriveBinaryOperatorKind(boundRelationalCaseClause.OperatorKind), BinaryOperatorKind.Invalid)
Dim relation As BinaryOperatorKind = If(valueExpression IsNot Nothing, Helper.DeriveBinaryOperatorKind(boundRelationalCaseClause.OperatorKind, leftOpt:=Nothing), BinaryOperatorKind.Invalid)
Dim CaseKind As CaseKind = CaseKind.Relational
Dim syntax As SyntaxNode = boundRelationalCaseClause.Syntax
Dim type As ITypeSymbol = Nothing
......
......@@ -297,7 +297,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
constantValue:=Nothing))
statements.Add(OperationFactory.CreateCompoundAssignmentExpressionStatement(
controlVariable, stepOperand,
BinaryOperatorKind.Add, controlType.IsNullableType(),
BinaryOperatorKind.Add, controlType.IsNullableType(), False,
Nothing, _semanticModel, stepValueExpression.Syntax))
End If
End If
......@@ -463,7 +463,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
End Select
End Function
Friend Shared Function DeriveBinaryOperatorKind(operatorKind As VisualBasic.BinaryOperatorKind) As BinaryOperatorKind
Friend Shared Function DeriveBinaryOperatorKind(operatorKind As VisualBasic.BinaryOperatorKind, leftOpt As BoundExpression) As BinaryOperatorKind
Select Case operatorKind And VisualBasic.BinaryOperatorKind.OpMask
Case VisualBasic.BinaryOperatorKind.Add
Return BinaryOperatorKind.Add
......@@ -471,8 +471,10 @@ Namespace Microsoft.CodeAnalysis.Semantics
Return BinaryOperatorKind.Subtract
Case VisualBasic.BinaryOperatorKind.Multiply
Return BinaryOperatorKind.Multiply
Case VisualBasic.BinaryOperatorKind.Divide, VisualBasic.BinaryOperatorKind.IntegerDivide
Case VisualBasic.BinaryOperatorKind.Divide
Return BinaryOperatorKind.Divide
Case VisualBasic.BinaryOperatorKind.IntegerDivide
Return BinaryOperatorKind.IntegerDivide
Case VisualBasic.BinaryOperatorKind.Modulo
Return BinaryOperatorKind.Remainder
Case VisualBasic.BinaryOperatorKind.And
......@@ -494,8 +496,12 @@ Namespace Microsoft.CodeAnalysis.Semantics
Case VisualBasic.BinaryOperatorKind.LessThanOrEqual
Return BinaryOperatorKind.LessThanOrEqual
Case VisualBasic.BinaryOperatorKind.Equals
Return BinaryOperatorKind.Equals
Return If(leftOpt?.Type.SpecialType = SpecialType.System_Object, BinaryOperatorKind.ObjectValueEquals, BinaryOperatorKind.Equals)
Case VisualBasic.BinaryOperatorKind.NotEquals
Return If(leftOpt?.Type.SpecialType = SpecialType.System_Object, BinaryOperatorKind.ObjectValueNotEquals, BinaryOperatorKind.NotEquals)
Case VisualBasic.BinaryOperatorKind.Is
Return BinaryOperatorKind.Equals
Case VisualBasic.BinaryOperatorKind.IsNot
Return BinaryOperatorKind.NotEquals
Case VisualBasic.BinaryOperatorKind.GreaterThanOrEqual
Return BinaryOperatorKind.GreaterThanOrEqual
......@@ -503,6 +509,10 @@ Namespace Microsoft.CodeAnalysis.Semantics
Return BinaryOperatorKind.GreaterThan
Case VisualBasic.BinaryOperatorKind.Power
Return BinaryOperatorKind.Power
Case VisualBasic.BinaryOperatorKind.Like
Return BinaryOperatorKind.Like
Case VisualBasic.BinaryOperatorKind.Concatenate
Return BinaryOperatorKind.Concatenate
Case Else
Return BinaryOperatorKind.Invalid
End Select
......
......@@ -48,7 +48,6 @@
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Content Include="Semantics\Async_Overload_Change_3.vb.txt" />
<Content Include="Semantics\BinaryOperatorsTestBaseline1_OperationTree.txt" />
<Content Include="Semantics\BinaryOperatorsTestBaseline1.txt" />
<Content Include="Semantics\BinaryOperatorsTestBaseline2.txt" />
<Content Include="Semantics\BinaryOperatorsTestBaseline3.txt" />
......
......@@ -283,7 +283,7 @@ IObjectCreationExpression (Constructor: Sub C2..ctor()) (OperationKind.ObjectCre
ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: ?, IsInvalid) (Syntax: 'Key .Field = 23')
Left: IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'Key .Field = 23')
Children(0)
Right: IBinaryOperatorExpression (BinaryOperatorKind.Equals, IsChecked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'Key .Field = 23')
Right: IBinaryOperatorExpression (BinaryOperatorKind.Equals, Checked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'Key .Field = 23')
Left: IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'Key .Field')
Children(1):
IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'Key .Field')
......
......@@ -1663,7 +1663,7 @@ End Class
Module Module1
Sub Main()
Sub Main()
Dim x, y As New B2()
Dim r As B2
r = x + y
......@@ -1685,7 +1685,7 @@ Module Module1
r = x Or y
r = x Xor y
r = x << 2
r = x >> 3
r = x >> 3
End Sub
End Module
]]>
......@@ -1695,26 +1695,26 @@ End Module
Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature)
comp.VerifyDiagnostics()
comp.VerifyAnalyzerDiagnostics({New BinaryOperatorVBTestAnalyzer}, Nothing, Nothing, False,
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x + y").WithArguments("Add").WithLocation(109, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x - y").WithArguments("Subtract").WithLocation(110, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x * y").WithArguments("Multiply").WithLocation(111, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x / y").WithArguments("Divide").WithLocation(112, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x \ y").WithArguments("Divide").WithLocation(113, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x Mod y").WithArguments("Remainder").WithLocation(114, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x ^ y").WithArguments("Power").WithLocation(115, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x = y").WithArguments("Equals").WithLocation(116, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x <> y").WithArguments("NotEquals").WithLocation(117, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x < y").WithArguments("LessThan").WithLocation(118, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x > y").WithArguments("GreaterThan").WithLocation(119, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x <= y").WithArguments("LessThanOrEqual").WithLocation(120, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x >= y").WithArguments("GreaterThanOrEqual").WithLocation(121, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x Like y").WithArguments("Invalid").WithLocation(122, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x & y").WithArguments("Invalid").WithLocation(123, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x And y").WithArguments("And").WithLocation(124, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x Or y").WithArguments("Or").WithLocation(125, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x Xor y").WithArguments("ExclusiveOr").WithLocation(126, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x << 2").WithArguments("LeftShift").WithLocation(127, 13),
Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x >> 3").WithArguments("RightShift").WithLocation(128, 13))
Diagnostic("BinaryUserDefinedOperator", "x + y").WithArguments("Add").WithLocation(109, 13),
Diagnostic("BinaryUserDefinedOperator", "x - y").WithArguments("Subtract").WithLocation(110, 13),
Diagnostic("BinaryUserDefinedOperator", "x * y").WithArguments("Multiply").WithLocation(111, 13),
Diagnostic("BinaryUserDefinedOperator", "x / y").WithArguments("Divide").WithLocation(112, 13),
Diagnostic("BinaryUserDefinedOperator", "x \ y").WithArguments("IntegerDivide").WithLocation(113, 13),
Diagnostic("BinaryUserDefinedOperator", "x Mod y").WithArguments("Remainder").WithLocation(114, 13),
Diagnostic("BinaryUserDefinedOperator", "x ^ y").WithArguments("Power").WithLocation(115, 13),
Diagnostic("BinaryUserDefinedOperator", "x = y").WithArguments("Equals").WithLocation(116, 13),
Diagnostic("BinaryUserDefinedOperator", "x <> y").WithArguments("NotEquals").WithLocation(117, 13),
Diagnostic("BinaryUserDefinedOperator", "x < y").WithArguments("LessThan").WithLocation(118, 13),
Diagnostic("BinaryUserDefinedOperator", "x > y").WithArguments("GreaterThan").WithLocation(119, 13),
Diagnostic("BinaryUserDefinedOperator", "x <= y").WithArguments("LessThanOrEqual").WithLocation(120, 13),
Diagnostic("BinaryUserDefinedOperator", "x >= y").WithArguments("GreaterThanOrEqual").WithLocation(121, 13),
Diagnostic("BinaryUserDefinedOperator", "x Like y").WithArguments("Like").WithLocation(122, 13),
Diagnostic("BinaryUserDefinedOperator", "x & y").WithArguments("Concatenate").WithLocation(123, 13),
Diagnostic("BinaryUserDefinedOperator", "x And y").WithArguments("And").WithLocation(124, 13),
Diagnostic("BinaryUserDefinedOperator", "x Or y").WithArguments("Or").WithLocation(125, 13),
Diagnostic("BinaryUserDefinedOperator", "x Xor y").WithArguments("ExclusiveOr").WithLocation(126, 13),
Diagnostic("BinaryUserDefinedOperator", "x << 2").WithArguments("LeftShift").WithLocation(127, 13),
Diagnostic("BinaryUserDefinedOperator", "x >> 3").WithArguments("RightShift").WithLocation(128, 13))
End Sub
<Fact>
......
......@@ -76,7 +76,7 @@ End Module
IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid) (Syntax: 'x = x + 10')
Expression: ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: B2, IsInvalid) (Syntax: 'x = x + 10')
Left: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: B2) (Syntax: 'x')
Right: IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: B2, IsInvalid) (Syntax: 'x + 10')
Right: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: B2, IsInvalid) (Syntax: 'x + 10')
Left: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: B2) (Syntax: 'x')
Right: ILiteralExpression (Text: 10) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 10, IsInvalid) (Syntax: '10')
")
......@@ -106,7 +106,7 @@ IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid) (Syntax: 'x
IExpressionStatement (OperationKind.ExpressionStatement) (Syntax: 'x = x + y')
Expression: ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: B2) (Syntax: 'x = x + y')
Left: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: B2) (Syntax: 'x')
Right: IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperatorMethod: Function B2.op_Addition(x As B2, y As B2) As B2) (OperationKind.BinaryOperatorExpression, Type: B2) (Syntax: 'x + y')
Right: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperatorMethod: Function B2.op_Addition(x As B2, y As B2) As B2) (OperationKind.BinaryOperatorExpression, Type: B2) (Syntax: 'x + y')
Left: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: B2) (Syntax: 'x')
Right: ILocalReferenceExpression: y (OperationKind.LocalReferenceExpression, Type: B2) (Syntax: 'y')
")
......@@ -235,7 +235,7 @@ End Class
Dim expectedOperationTree = <![CDATA[
IIfStatement (OperationKind.IfStatement) (Syntax: 'If x <> 0 T ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.NotEquals, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'x <> 0')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.NotEquals, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'x <> 0')
Left: IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x')
Right: ILiteralExpression (Text: 0) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0')
IfTrue: IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'If x <> 0 T ... End If')
......
......@@ -23,7 +23,7 @@ End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IBlockStatement (3 statements) (OperationKind.BlockStatement) (Syntax: 'Sub Method( ... End Sub')
IIfStatement (OperationKind.IfStatement) (Syntax: 'If 1 > 2 Th ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2')
IfTrue: IBlockStatement (0 statements) (OperationKind.BlockStatement) (Syntax: 'If 1 > 2 Th ... End If')
......@@ -53,7 +53,7 @@ End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IBlockStatement (3 statements) (OperationKind.BlockStatement) (Syntax: 'Sub New()'B ... End Sub')
IIfStatement (OperationKind.IfStatement) (Syntax: 'If 1 > 2 Th ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2')
IfTrue: IBlockStatement (0 statements) (OperationKind.BlockStatement) (Syntax: 'If 1 > 2 Th ... End If')
......@@ -86,7 +86,7 @@ Dim expectedOperationTree = <![CDATA[
IBlockStatement (4 statements, 1 locals) (OperationKind.BlockStatement) (Syntax: 'Function Me ... nd Function')
Locals: Local_1: Method As System.Boolean
IIfStatement (OperationKind.IfStatement) (Syntax: 'If 1 > 2 Th ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2')
IfTrue: IBlockStatement (0 statements) (OperationKind.BlockStatement) (Syntax: 'If 1 > 2 Th ... End If')
......@@ -121,7 +121,7 @@ Dim expectedOperationTree = <![CDATA[
IBlockStatement (3 statements, 1 locals) (OperationKind.BlockStatement) (Syntax: 'Get'BIND:"G ... End Get')
Locals: Local_1: Prop As System.Int32
IIfStatement (OperationKind.IfStatement) (Syntax: 'If 1 > 2 Th ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2')
IfTrue: IBlockStatement (0 statements) (OperationKind.BlockStatement) (Syntax: 'If 1 > 2 Th ... End If')
......@@ -157,7 +157,7 @@ End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IBlockStatement (3 statements) (OperationKind.BlockStatement) (Syntax: 'Set(Value A ... End Set')
IIfStatement (OperationKind.IfStatement) (Syntax: 'If 1 > 2 Th ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2')
IfTrue: IBlockStatement (0 statements) (OperationKind.BlockStatement) (Syntax: 'If 1 > 2 Th ... End If')
......@@ -197,7 +197,7 @@ End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IBlockStatement (3 statements) (OperationKind.BlockStatement) (Syntax: 'AddHandler( ... AddHandler')
IIfStatement (OperationKind.IfStatement) (Syntax: 'If 1 > 2 Th ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2')
IfTrue: IBlockStatement (0 statements) (OperationKind.BlockStatement) (Syntax: 'If 1 > 2 Th ... End If')
......@@ -237,7 +237,7 @@ End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IBlockStatement (3 statements) (OperationKind.BlockStatement) (Syntax: 'RemoveHandl ... moveHandler')
IIfStatement (OperationKind.IfStatement) (Syntax: 'If 1 > 2 Th ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2')
IfTrue: IBlockStatement (0 statements) (OperationKind.BlockStatement) (Syntax: 'If 1 > 2 Th ... End If')
......@@ -277,7 +277,7 @@ End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IBlockStatement (3 statements) (OperationKind.BlockStatement) (Syntax: 'RaiseEvent( ... RaiseEvent')
IIfStatement (OperationKind.IfStatement) (Syntax: 'If 1 > 2 Th ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2')
IfTrue: IBlockStatement (0 statements) (OperationKind.BlockStatement) (Syntax: 'If 1 > 2 Th ... End If')
......@@ -310,7 +310,7 @@ Dim expectedOperationTree = <![CDATA[
IBlockStatement (4 statements, 1 locals) (OperationKind.BlockStatement) (Syntax: 'Public Shar ... nd Operator')
Locals: Local_1: <anonymous local> As System.Int32
IIfStatement (OperationKind.IfStatement) (Syntax: 'If 1 > 2 Th ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.GreaterThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, Constant: False) (Syntax: '1 > 2')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2')
IfTrue: IBlockStatement (0 statements) (OperationKind.BlockStatement) (Syntax: 'If 1 > 2 Th ... End If')
......
......@@ -300,7 +300,7 @@ IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclaratio
Variables: Local_1: a As System.Int32
Initializer: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int32, IsInvalid) (Syntax: 'b + c')
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'b + c')
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'b + c')
Left: IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'b')
Children(0)
Right: IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'c')
......@@ -1188,7 +1188,7 @@ IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclaratio
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'New Integer(1) {}')
Dimension Sizes(1):
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, Constant: 2) (Syntax: '1')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, Constant: 2) (Syntax: '1')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Initializer: IArrayInitializer (0 elements) (OperationKind.ArrayInitializer) (Syntax: '{}')
......@@ -1221,7 +1221,7 @@ IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclaratio
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: IArrayCreationExpression (Element Type: System.Int32()) (OperationKind.ArrayCreationExpression, Type: System.Int32()()) (Syntax: 'New Integer(1)() {}')
Dimension Sizes(1):
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, Constant: 2) (Syntax: '1')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, Constant: 2) (Syntax: '1')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Initializer: IArrayInitializer (0 elements) (OperationKind.ArrayInitializer) (Syntax: '{}')
......@@ -1681,7 +1681,7 @@ IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclaratio
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: IArrayCreationExpression (Element Type: System.Char) (OperationKind.ArrayCreationExpression, Type: System.Char()) (Syntax: 'New Char(1) {}')
Dimension Sizes(1):
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, Constant: 2) (Syntax: '1')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, Constant: 2) (Syntax: '1')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Initializer: IArrayInitializer (0 elements) (OperationKind.ArrayInitializer) (Syntax: '{}')
......@@ -2101,7 +2101,7 @@ IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclaratio
IBlockStatement (3 statements, 1 locals) (OperationKind.BlockStatement) (Syntax: 'Function(num) num < 5')
Locals: Local_1: <anonymous local> As System.Boolean
IReturnStatement (OperationKind.ReturnStatement) (Syntax: 'num < 5')
ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.LessThan, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'num < 5')
ReturnedValue: IBinaryOperatorExpression (BinaryOperatorKind.LessThan, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'num < 5')
Left: IParameterReferenceExpression: num (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'num')
Right: ILiteralExpression (Text: 5) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 5) (Syntax: '5')
ILabelStatement (Label: exit) (OperationKind.LabelStatement) (Syntax: 'Function(num) num < 5')
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Semantics
Imports Microsoft.CodeAnalysis.Test.Utilities
......@@ -107,7 +107,7 @@ IForEachLoopStatement (Iteration variable: null) (LoopKind.ForEach) (OperationKi
Collection: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: System.String) (Syntax: 'x')
Body: IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'For Each y ... Next')
IIfStatement (OperationKind.IfStatement) (Syntax: 'If y = "B"c ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.Equals, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'y = "B"c')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.Equals, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'y = "B"c')
Left: ILocalReferenceExpression: y (OperationKind.LocalReferenceExpression, Type: System.Char) (Syntax: 'y')
Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Char, Constant: B) (Syntax: '"B"c')
IfTrue: IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'If y = "B"c ... End If')
......@@ -155,7 +155,7 @@ IForEachLoopStatement (Iteration variable: null) (LoopKind.ForEach) (OperationKi
Collection: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: System.String) (Syntax: 'x')
Body: IBlockStatement (2 statements) (OperationKind.BlockStatement) (Syntax: 'For Each y ... Next y, x')
IIfStatement (OperationKind.IfStatement) (Syntax: 'If y = "B"c ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.Equals, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'y = "B"c')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.Equals, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'y = "B"c')
Left: ILocalReferenceExpression: y (OperationKind.LocalReferenceExpression, Type: System.Char) (Syntax: 'y')
Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Char, Constant: B) (Syntax: '"B"c')
IfTrue: IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'If y = "B"c ... End If')
......@@ -424,7 +424,7 @@ End Class
]]>.Value
Dim expectedOperationTree = <![CDATA[
Dim expectedOperationTree = <![CDATA[
IForEachLoopStatement (Iteration variable: null) (LoopKind.ForEach) (OperationKind.LoopStatement) (Syntax: 'For Each co ... Next')
Collection: ILocalReferenceExpression: countries (OperationKind.LocalReferenceExpression, Type: System.Linq.IOrderedEnumerable(Of <anonymous type: Key CountryName As System.String, Key CustomersInCountry As System.Collections.Generic.IEnumerable(Of Customer), Key Count As System.Int32>)) (Syntax: 'countries')
Body: IBlockStatement (2 statements) (OperationKind.BlockStatement) (Syntax: 'For Each co ... Next')
......@@ -433,8 +433,8 @@ IForEachLoopStatement (Iteration variable: null) (LoopKind.ForEach) (OperationKi
Instance Receiver: null
Arguments(1):
IArgument (ArgumentKind.Explicit, Matching Parameter: message) (OperationKind.Argument) (Syntax: 'country.Cou ... untry.Count')
IBinaryOperatorExpression (BinaryOperatorKind.Invalid, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: 'country.Cou ... untry.Count')
Left: IBinaryOperatorExpression (BinaryOperatorKind.Invalid, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: 'country.Cou ... & " count="')
IBinaryOperatorExpression (BinaryOperatorKind.Concatenate, Checked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: 'country.Cou ... untry.Count')
Left: IBinaryOperatorExpression (BinaryOperatorKind.Concatenate, Checked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: 'country.Cou ... & " count="')
Left: IPropertyReferenceExpression: ReadOnly Property <anonymous type: Key CountryName As System.String, Key CustomersInCountry As System.Collections.Generic.IEnumerable(Of Customer), Key Count As System.Int32>.CountryName As System.String (OperationKind.PropertyReferenceExpression, Type: System.String) (Syntax: 'country.CountryName')
Instance Receiver: ILocalReferenceExpression: country (OperationKind.LocalReferenceExpression, Type: <anonymous type: Key CountryName As System.String, Key CustomersInCountry As System.Collections.Generic.IEnumerable(Of Customer), Key Count As System.Int32>) (Syntax: 'country')
Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.String, Constant: " count=") (Syntax: '" count="')
......@@ -453,9 +453,9 @@ IForEachLoopStatement (Iteration variable: null) (LoopKind.ForEach) (OperationKi
Instance Receiver: null
Arguments(1):
IArgument (ArgumentKind.Explicit, Matching Parameter: message) (OperationKind.Argument) (Syntax: '" " & cus ... stomer.City')
IBinaryOperatorExpression (BinaryOperatorKind.Invalid, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: '" " & cus ... stomer.City')
Left: IBinaryOperatorExpression (BinaryOperatorKind.Invalid, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: '" " & cus ... Name & " "')
Left: IBinaryOperatorExpression (BinaryOperatorKind.Invalid, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: '" " & cus ... CompanyName')
IBinaryOperatorExpression (BinaryOperatorKind.Concatenate, Checked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: '" " & cus ... stomer.City')
Left: IBinaryOperatorExpression (BinaryOperatorKind.Concatenate, Checked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: '" " & cus ... Name & " "')
Left: IBinaryOperatorExpression (BinaryOperatorKind.Concatenate, Checked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: '" " & cus ... CompanyName')
Left: ILiteralExpression (OperationKind.LiteralExpression, Type: System.String, Constant: " ") (Syntax: '" "')
Right: IPropertyReferenceExpression: Property Customer.CompanyName As System.String (OperationKind.PropertyReferenceExpression, Type: System.String) (Syntax: 'customer.CompanyName')
Instance Receiver: ILocalReferenceExpression: customer (OperationKind.LocalReferenceExpression, Type: Customer) (Syntax: 'customer')
......@@ -747,7 +747,7 @@ IForEachLoopStatement (Iteration variable: null) (LoopKind.ForEach) (OperationKi
Body: IBlockStatement (2 statements) (OperationKind.BlockStatement) (Syntax: 'For Each s ... Next')
IIfStatement (OperationKind.IfStatement) (Syntax: 'If (s = "on ... End If')
Condition: IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: System.Boolean) (Syntax: '(s = "one")')
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Equals, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's = "one"')
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Equals, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 's = "one"')
Left: ILocalReferenceExpression: s (OperationKind.LocalReferenceExpression, Type: System.String) (Syntax: 's')
Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.String, Constant: "one") (Syntax: '"one"')
IfTrue: IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'If (s = "on ... End If')
......@@ -784,14 +784,14 @@ Class C
End Class
]]>.Value
Dim expectedOperationTree = <![CDATA[
Dim expectedOperationTree = <![CDATA[
IForEachLoopStatement (Iteration variable: null) (LoopKind.ForEach) (OperationKind.LoopStatement) (Syntax: 'For Each o ... Next')
Collection: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Collections.IEnumerable) (Syntax: 'c')
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: IParameterReferenceExpression: c (OperationKind.ParameterReferenceExpression, Type: System.Object()) (Syntax: 'c')
Body: IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'For Each o ... Next')
IIfStatement (OperationKind.IfStatement) (Syntax: 'If o IsNot ... Return True')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.Invalid) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'o IsNot Nothing')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.NotEquals) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'o IsNot Nothing')
Left: ILocalReferenceExpression: o (OperationKind.LocalReferenceExpression, Type: System.Object) (Syntax: 'o')
Right: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Object, Constant: null) (Syntax: 'Nothing')
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
......
......@@ -36,7 +36,7 @@ IForLoopStatement (LoopKind.For) (OperationKind.LoopStatement) (Syntax: 'For i A
IExpressionStatement (OperationKind.ExpressionStatement) (Syntax: 'myarray.Length - 1')
Expression: ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.Int32) (Syntax: 'myarray.Length - 1')
Left: ISyntheticLocalReferenceExpression (SynthesizedLocalKind.ForLoopLimitValue) (OperationKind.SyntheticLocalReferenceExpression, Type: System.Int32) (Syntax: 'myarray.Length - 1')
Right: IBinaryOperatorExpression (BinaryOperatorKind.Subtract, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'myarray.Length - 1')
Right: IBinaryOperatorExpression (BinaryOperatorKind.Subtract, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'myarray.Length - 1')
Left: IPropertyReferenceExpression: ReadOnly Property System.Array.Length As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'myarray.Length')
Instance Receiver: ILocalReferenceExpression: myarray (OperationKind.LocalReferenceExpression, Type: System.Int32()) (Syntax: 'myarray')
Right: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
......@@ -476,7 +476,7 @@ IForLoopStatement (LoopKind.For) (OperationKind.LoopStatement) (Syntax: 'For I =
IExpressionStatement (OperationKind.ExpressionStatement) (Syntax: 'I + 1')
Expression: ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.Int32) (Syntax: 'I + 1')
Left: ILocalReferenceExpression: J (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'J')
Right: IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'I + 1')
Right: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'I + 1')
Left: ILocalReferenceExpression: I (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'I')
Right: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
AtLoopBottom:
......@@ -652,7 +652,7 @@ IForLoopStatement (LoopKind.For) (OperationKind.LoopStatement) (Syntax: 'For i A
IArgument (ArgumentKind.Explicit, Matching Parameter: x) (OperationKind.Argument) (Syntax: '30 + i')
IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int64) (Syntax: '30 + i')
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '30 + i')
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '30 + i')
Left: ILiteralExpression (Text: 30) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 30) (Syntax: '30')
Right: ILocalReferenceExpression: i (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'i')
InConversion: null
......@@ -875,8 +875,8 @@ IForLoopStatement (LoopKind.For) (OperationKind.LoopStatement) (Syntax: 'For i A
Operand: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'For i As In ... Next')
Body: IBlockStatement (1 statements) (OperationKind.BlockStatement) (Syntax: 'For i As In ... Next')
IIfStatement (OperationKind.IfStatement) (Syntax: 'If i Mod 2 ... End If')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.Equals, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'i Mod 2 = 0')
Left: IBinaryOperatorExpression (BinaryOperatorKind.Remainder, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'i Mod 2')
Condition: IBinaryOperatorExpression (BinaryOperatorKind.Equals, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean) (Syntax: 'i Mod 2 = 0')
Left: IBinaryOperatorExpression (BinaryOperatorKind.Remainder, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'i Mod 2')
Left: ILocalReferenceExpression: i (OperationKind.LocalReferenceExpression, Type: System.Int32) (Syntax: 'i')
Right: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2')
Right: ILiteralExpression (Text: 0) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0) (Syntax: '0')
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Semantics
Imports Microsoft.CodeAnalysis.Test.Utilities
......@@ -24,7 +24,7 @@ Dim expectedOperationTree = <![CDATA[
ITupleExpression (OperationKind.TupleExpression, Type: (x As System.Int32, System.Int32)) (Syntax: '(x, x + y)')
Elements(2):
IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x')
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x + y')
Left: IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x')
Right: IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'y')
]]>.Value
......@@ -47,7 +47,7 @@ Class Class1
End Sub
End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
Dim expectedOperationTree = <![CDATA[
IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: <anonymous type: Key Amount As System.Int32, Key Message As System.String>) (Syntax: 'New With {' ... }')
Initializers(2):
ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.Int32) (Syntax: 'Key .Amount = x')
......@@ -57,7 +57,7 @@ IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpress
ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.String) (Syntax: 'Key .Messag ... "Hello" + y')
Left: IPropertyReferenceExpression: ReadOnly Property <anonymous type: Key Amount As System.Int32, Key Message As System.String>.Message As System.String (Static) (OperationKind.PropertyReferenceExpression, Type: System.String) (Syntax: 'Message')
Instance Receiver: null
Right: IBinaryOperatorExpression (BinaryOperatorKind.Invalid, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: '"Hello" + y')
Right: IBinaryOperatorExpression (BinaryOperatorKind.Concatenate, Checked) (OperationKind.BinaryOperatorExpression, Type: System.String) (Syntax: '"Hello" + y')
Left: ILiteralExpression (OperationKind.LiteralExpression, Type: System.String, Constant: "Hello") (Syntax: '"Hello"')
Right: IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, Type: System.String) (Syntax: 'y')
]]>.Value
......@@ -482,7 +482,7 @@ End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
INameOfExpression (OperationKind.NameOfExpression, Type: System.String, Constant: null, IsInvalid) (Syntax: 'NameOf(x + y)')
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, IsInvalid) (Syntax: 'x + y')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, IsInvalid) (Syntax: 'x + y')
Left: IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32, IsInvalid) (Syntax: 'x')
Right: IParameterReferenceExpression: y (OperationKind.ParameterReferenceExpression, Type: System.Int32, IsInvalid) (Syntax: 'y')
]]>.Value
......@@ -692,13 +692,13 @@ IOperation: (OperationKind.None) (Syntax: 'ReDim intArray(x, x, x)')
IOperation: (OperationKind.None) (Syntax: 'intArray(x, x, x)')
Children(4):
ILocalReferenceExpression: intArray (OperationKind.LocalReferenceExpression, Type: System.Int32(,,)) (Syntax: 'intArray')
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x')
Left: IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x')
Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'x')
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x')
Left: IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x')
Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'x')
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: 'x')
Left: IParameterReferenceExpression: x (OperationKind.ParameterReferenceExpression, Type: System.Int32) (Syntax: 'x')
Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: 'x')
]]>.Value
......
......@@ -179,7 +179,7 @@ End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IFieldInitializer (Field: C.s1 As System.Int32) (OperationKind.FieldInitializer) (Syntax: '= 1 + F()')
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '1 + F()')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '1 + F()')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: IInvocationExpression (Function C.F() As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'F()')
Instance Receiver: null
......@@ -205,7 +205,7 @@ End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IFieldInitializer (Field: C.i1 As System.Int32) (OperationKind.FieldInitializer) (Syntax: '= 1 + F()')
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '1 + F()')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '1 + F()')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: IInvocationExpression (Function C.F() As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'F()')
Instance Receiver: null
......@@ -231,7 +231,7 @@ End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IPropertyInitializer (Property: Property C.P1 As System.Int32) (OperationKind.PropertyInitializer) (Syntax: '= 1 + F()')
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '1 + F()')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '1 + F()')
Left: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: IInvocationExpression (Function C.F() As System.Int32) (OperationKind.InvocationExpression, Type: System.Int32) (Syntax: 'F()')
Instance Receiver: null
......
......@@ -506,7 +506,7 @@ IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclaratio
Variables: Local_1: i1 As System.Int32()
Initializer: IArrayCreationExpression (Element Type: System.Int32) (OperationKind.ArrayCreationExpression, Type: System.Int32()) (Syntax: 'i1(2)')
Dimension Sizes(1):
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, Constant: 3) (Syntax: '2')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, Constant: 3) (Syntax: '2')
Left: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2) (Syntax: '2')
Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '2')
Initializer: null
......
......@@ -211,7 +211,7 @@ Class Program
End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IUnaryOperatorExpression (UnaryOperatorKind.Plus, IsChecked) (OperationKind.UnaryOperatorExpression, Type: ?, IsInvalid) (Syntax: '+x')
IUnaryOperatorExpression (UnaryOperatorKind.Plus, Checked) (OperationKind.UnaryOperatorExpression, Type: ?, IsInvalid) (Syntax: '+x')
Operand: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: Program, IsInvalid) (Syntax: 'x')
]]>.Value
......@@ -241,10 +241,10 @@ Class Program
End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'x + (y * args.Length)')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'x + (y * args.Length)')
Left: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: Program) (Syntax: 'x')
Right: IParenthesizedExpression (OperationKind.ParenthesizedExpression, Type: ?, IsInvalid) (Syntax: '(y * args.Length)')
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Multiply, IsChecked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'y * args.Length')
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Multiply, Checked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'y * args.Length')
Left: IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'y')
Children(0)
Right: IPropertyReferenceExpression: ReadOnly Property System.Array.Length As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'args.Length')
......@@ -377,10 +377,10 @@ End Class]]>.Value
Dim expectedOperationTree = <![CDATA[
IArrayCreationExpression (Element Type: X) (OperationKind.ArrayCreationExpression, Type: X(), IsInvalid) (Syntax: 'New X(Program - 1) {{1}}')
Dimension Sizes(1):
IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, IsInvalid) (Syntax: 'Program - 1')
IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, IsInvalid) (Syntax: 'Program - 1')
Left: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Int32, IsInvalid) (Syntax: 'Program - 1')
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Subtract, IsChecked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'Program - 1')
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Subtract, Checked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'Program - 1')
Left: IOperation: (OperationKind.None, IsInvalid) (Syntax: 'Program')
Right: ILiteralExpression (Text: 1) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1) (Syntax: '1')
Right: ILiteralExpression (OperationKind.LiteralExpression, Type: System.Int32, Constant: 1, IsInvalid) (Syntax: 'Program - 1')
......
......@@ -126,7 +126,7 @@ Dim expectedOperationTree = <![CDATA[
IIfStatement (OperationKind.IfStatement, IsInvalid) (Syntax: 'If x = Noth ... End If')
Condition: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Boolean, IsInvalid) (Syntax: 'x = Nothing')
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Equals, IsChecked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'x = Nothing')
Operand: IBinaryOperatorExpression (BinaryOperatorKind.Equals, Checked) (OperationKind.BinaryOperatorExpression, Type: ?, IsInvalid) (Syntax: 'x = Nothing')
Left: ILocalReferenceExpression: x (OperationKind.LocalReferenceExpression, Type: Program, IsInvalid) (Syntax: 'x')
Right: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: Program, Constant: null, IsInvalid) (Syntax: 'Nothing')
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
......@@ -499,7 +499,7 @@ End Module]]>.Value
Dim expectedOperationTree = <![CDATA[
IInvalidStatement (OperationKind.InvalidStatement, IsInvalid) (Syntax: 'ElseIf args.Length = 0')
Children(1):
IBinaryOperatorExpression (BinaryOperatorKind.Equals, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, IsInvalid) (Syntax: 'args.Length = 0')
IBinaryOperatorExpression (BinaryOperatorKind.Equals, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Boolean, IsInvalid) (Syntax: 'args.Length = 0')
Left: IPropertyReferenceExpression: ReadOnly Property System.Array.Length As System.Int32 (OperationKind.PropertyReferenceExpression, Type: System.Int32, IsInvalid) (Syntax: 'args.Length')
Instance Receiver: IParameterReferenceExpression: args (OperationKind.ParameterReferenceExpression, Type: System.String(), IsInvalid) (Syntax: 'args')
Right: ILiteralExpression (Text: 0) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 0, IsInvalid) (Syntax: '0')
......
......@@ -117,27 +117,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to IBlockStatement (6069 statements, 19 locals) (OperationKind.BlockStatement) (Syntax: &apos;Sub Main() ... End Sub&apos;)
''' Locals: Local_1: BoFalse As System.Boolean
''' Local_2: BoTrue As System.Boolean
''' Local_3: SB As System.SByte
''' Local_4: By As System.Byte
''' Local_5: Sh As System.Int16
''' Local_6: US As System.UInt16
''' Local_7: [In] As System.Int32
''' Local_8: UI As System.UInt32
''' Local_9: Lo As System.Int64
''' Local_10: UL As System.UInt64
''' Local_11: De As System.Decimal
''' Local_ [rest of string was truncated]&quot;;.
'''</summary>
Friend Shared ReadOnly Property BinaryOperatorsTestBaseline1_OperationTree() As String
Get
Return ResourceManager.GetString("BinaryOperatorsTestBaseline1_OperationTree", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to BC30452: Operator &apos;+&apos; is not defined for types &apos;Date&apos; and &apos;Boolean&apos;.
''' result = Da + BoFalse
......@@ -293,7 +272,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.My.Resources
'''
'''Module Module1
'''
''' Sub Main() &apos;BIND:&quot;Sub Main()&quot;
''' Sub Main()
''' Dim BoFalse As Boolean
''' Dim BoTrue As Boolean
''' Dim SB As SByte
......@@ -303,7 +282,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.My.Resources
''' Dim [In] As Integer
''' Dim UI As UInteger
''' Dim Lo As Long
''' Dim U [rest of string was truncated]&quot;;.
''' Dim UL As ULong
''' [rest of string was truncated]&quot;;.
'''</summary>
Friend Shared ReadOnly Property BinaryOperatorsTestSource1() As String
Get
......
......@@ -124,9 +124,6 @@
<data name="BinaryOperatorsTestBaseline1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Semantics/BinaryOperatorsTestBaseline1.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="BinaryOperatorsTestBaseline1_OperationTree" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Semantics/BinaryOperatorsTestBaseline1_OperationTree.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="BinaryOperatorsTestBaseline2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Semantics/BinaryOperatorsTestBaseline2.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
......
......@@ -35,7 +35,7 @@ IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.Conve
ISimpleAssignmentExpression (OperationKind.SimpleAssignmentExpression, Type: System.Int32) (Syntax: '.c = .b + .a')
Left: IPropertyReferenceExpression: Property <anonymous type: a As System.Int32, b As System.Int32, c As System.Int32>.c As System.Int32 (Static) (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: 'c')
Instance Receiver: null
Right: IBinaryOperatorExpression (BinaryOperatorKind.Add, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '.b + .a')
Right: IBinaryOperatorExpression (BinaryOperatorKind.Add, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32) (Syntax: '.b + .a')
Left: IPropertyReferenceExpression: Property <anonymous type: a As System.Int32, b As System.Int32, c As System.Int32>.b As System.Int32 (Static) (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: '.b')
Instance Receiver: null
Right: IPropertyReferenceExpression: Property <anonymous type: a As System.Int32, b As System.Int32, c As System.Int32>.a As System.Int32 (Static) (OperationKind.PropertyReferenceExpression, Type: System.Int32) (Syntax: '.a')
......@@ -656,7 +656,7 @@ End Module]]>.Value
Dim expectedOperationTree = <![CDATA[
IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpression, Type: <anonymous type: $0 As System.Int32>, IsInvalid) (Syntax: 'New With {a * 2}')
Initializers(1):
IBinaryOperatorExpression (BinaryOperatorKind.Multiply, IsChecked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, IsInvalid) (Syntax: 'a * 2')
IBinaryOperatorExpression (BinaryOperatorKind.Multiply, Checked) (OperationKind.BinaryOperatorExpression, Type: System.Int32, IsInvalid) (Syntax: 'a * 2')
Left: ILocalReferenceExpression: a (OperationKind.LocalReferenceExpression, Type: System.Int32, IsInvalid) (Syntax: 'a')
Right: ILiteralExpression (Text: 2) (OperationKind.LiteralExpression, Type: System.Int32, Constant: 2, IsInvalid) (Syntax: '2')
]]>.Value
......
......@@ -25,7 +25,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics
Try
Dim compilationDef =
Dim compilationDef =
<compilation name="VBBinaryOperators1">
<file name="lib.vb">
<%= My.Resources.Resource.PrintResultTestSource %>
......@@ -35,50 +35,17 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Semantics
</file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef, TestOptions.ReleaseExe)
Assert.True(compilation.Options.CheckOverflow)
CompileAndVerify(compilation, expectedOutput:=My.Resources.Resource.BinaryOperatorsTestBaseline1)
compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef, TestOptions.ReleaseExe.WithOverflowChecks(False))
Assert.False(compilation.Options.CheckOverflow)
CompileAndVerify(compilation, expectedOutput:=My.Resources.Resource.BinaryOperatorsTestBaseline1)
Catch ex As Exception
Assert.Null(ex)
Finally
System.Threading.Thread.CurrentThread.CurrentCulture = currCulture
End Try
End Sub
<Fact>
Public Sub Test1_IOperation()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef, TestOptions.ReleaseExe)
Dim currCulture = System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US", useUserOverride:=False)
Assert.True(compilation.Options.CheckOverflow)
Try
CompileAndVerify(compilation, expectedOutput:=My.Resources.Resource.BinaryOperatorsTestBaseline1)
Dim compilationDef =
<compilation name="VBBinaryOperators1">
<file name="lib.vb">
<%= My.Resources.Resource.PrintResultTestSource %>
</file>
<file name="a.vb">
<%= My.Resources.Resource.BinaryOperatorsTestSource1 %>
</file>
</compilation>
Dim compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef, TestOptions.ReleaseExe)
Dim expectedOperationTree = My.Resources.Resource.BinaryOperatorsTestBaseline1_OperationTree
compilation = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(compilationDef, TestOptions.ReleaseExe.WithOverflowChecks(False))
Dim expectedDiagnostics = String.Empty
Assert.False(compilation.Options.CheckOverflow)
VerifyOperationTreeAndDiagnosticsForTest(Of MethodBlockSyntax)(Compilation, "a.vb", expectedOperationTree, expectedDiagnostics)
CompileAndVerify(compilation, expectedOutput:=My.Resources.Resource.BinaryOperatorsTestBaseline1)
Catch ex As Exception
Assert.Null(ex)
......
......@@ -6,7 +6,7 @@ Imports System
Module Module1
Sub Main() 'BIND:"Sub Main()"
Sub Main()
Dim BoFalse As Boolean
Dim BoTrue As Boolean
Dim SB As SByte
......
......@@ -781,7 +781,7 @@ public override void VisitUnaryOperatorExpression(IUnaryOperatorExpression opera
if (operation.IsChecked)
{
kindStr += ", IsChecked";
kindStr += ", Checked";
}
LogString($" ({kindStr})");
......@@ -803,12 +803,12 @@ public override void VisitBinaryOperatorExpression(IBinaryOperatorExpression ope
if (operation.IsChecked)
{
kindStr += ", IsChecked";
kindStr += ", Checked";
}
if (operation.IsCompareText)
{
kindStr += "-IsCompareText";
kindStr += ", CompareText";
}
LogString($" ({kindStr})");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册