diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index ff9314f46ebcbe7112b13bfb1889be3ac7efade0..5262553c73deea8aad8cd83cd529a0b5359439b6 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -998,7 +998,7 @@ private IParameterInitializer CreateBoundParameterEqualsValueOperation(BoundPara private IBlockStatement CreateBoundBlockOperation(BoundBlock boundBlock) { Lazy> statements = - new Lazy>(() => boundBlock.Statements.Select(s => Create(s)).Where(s => s.Kind != OperationKind.None).ToImmutableArray()); + new Lazy>(() => boundBlock.Statements.Select(s => Create(s)).ToImmutableArray()); ImmutableArray locals = boundBlock.Locals.As(); SyntaxNode syntax = boundBlock.Syntax; diff --git a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb index 8eed84d14b0504687faf8c638bf54c331abf5d8a..90f5769741f7fb4d781a1c1a633a707485f5e055 100644 --- a/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb +++ b/src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb @@ -292,7 +292,7 @@ Namespace Microsoft.CodeAnalysis.Semantics End Function Private Function CreateBoundMyBaseReferenceOperation(boundMyBaseReference As BoundMyBaseReference) As IInstanceReferenceExpression - Dim instanceReferenceKind As InstanceReferenceKind = instanceReferenceKind.BaseClass + Dim instanceReferenceKind As InstanceReferenceKind = InstanceReferenceKind.BaseClass Dim syntax As SyntaxNode = boundMyBaseReference.Syntax Dim type As ITypeSymbol = boundMyBaseReference.Type Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundMyBaseReference.ConstantValueOpt) @@ -300,7 +300,7 @@ Namespace Microsoft.CodeAnalysis.Semantics End Function Private Function CreateBoundMyClassReferenceOperation(boundMyClassReference As BoundMyClassReference) As IInstanceReferenceExpression - Dim instanceReferenceKind As InstanceReferenceKind = instanceReferenceKind.ThisClass + Dim instanceReferenceKind As InstanceReferenceKind = InstanceReferenceKind.ThisClass Dim syntax As SyntaxNode = boundMyClassReference.Syntax Dim type As ITypeSymbol = boundMyClassReference.Type Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundMyClassReference.ConstantValueOpt) @@ -453,7 +453,7 @@ Namespace Microsoft.CodeAnalysis.Semantics End Function Private Function CreateBoundUserDefinedShortCircuitingOperatorOperation(boundUserDefinedShortCircuitingOperator As BoundUserDefinedShortCircuitingOperator) As IBinaryOperatorExpression - Dim binaryOperationKind As BinaryOperationKind = If((boundUserDefinedShortCircuitingOperator.BitwiseOperator.OperatorKind And BinaryOperatorKind.And) <> 0, binaryOperationKind.OperatorMethodConditionalAnd, binaryOperationKind.OperatorMethodConditionalOr) + Dim binaryOperationKind As BinaryOperationKind = If((boundUserDefinedShortCircuitingOperator.BitwiseOperator.OperatorKind And BinaryOperatorKind.And) <> 0, BinaryOperationKind.OperatorMethodConditionalAnd, BinaryOperationKind.OperatorMethodConditionalOr) Dim leftOperand As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundUserDefinedShortCircuitingOperator.LeftOperand)) Dim rightOperand As Lazy(Of IOperation) = New Lazy(Of IOperation)(Function() Create(boundUserDefinedShortCircuitingOperator.BitwiseOperator.Right)) Dim usesOperatorMethod As Boolean = True @@ -927,7 +927,16 @@ Namespace Microsoft.CodeAnalysis.Semantics Private Function CreateBoundBlockOperation(boundBlock As BoundBlock) As IBlockStatement Dim statements As Lazy(Of ImmutableArray(Of IOperation)) = New Lazy(Of ImmutableArray(Of IOperation))( Function() - Return boundBlock.Statements.Select(Function(n) Create(n)).Where(Function(s) s.Kind <> OperationKind.None).ToImmutableArray() + Return boundBlock.Statements.Select(Function(n) Create(n)).Where( + Function(statement) + ' Don't include the method/operator/accessor declaration in the block + Return statement.Syntax.Kind() <> SyntaxKind.OperatorStatement AndAlso + statement.Syntax.Kind() <> SyntaxKind.SubStatement AndAlso + statement.Syntax.Kind() <> SyntaxKind.FunctionStatement AndAlso + statement.Syntax.Kind() <> SyntaxKind.GetAccessorStatement AndAlso + statement.Syntax.Kind() <> SyntaxKind.SetAccessorStatement + End Function + ).ToImmutableArray() End Function) Dim locals As ImmutableArray(Of ILocalSymbol) = boundBlock.Locals.As(Of ILocalSymbol)() Dim syntax As SyntaxNode = boundBlock.Syntax @@ -1010,7 +1019,7 @@ Namespace Microsoft.CodeAnalysis.Semantics Private Function CreateBoundGotoStatementOperation(boundGotoStatement As BoundGotoStatement) As IBranchStatement Dim target As ILabelSymbol = boundGotoStatement.Label - Dim branchKind As BranchKind = branchKind.GoTo + Dim branchKind As BranchKind = BranchKind.GoTo Dim syntax As SyntaxNode = boundGotoStatement.Syntax Dim type As ITypeSymbol = Nothing Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)() @@ -1019,7 +1028,7 @@ Namespace Microsoft.CodeAnalysis.Semantics Private Function CreateBoundContinueStatementOperation(boundContinueStatement As BoundContinueStatement) As IBranchStatement Dim target As ILabelSymbol = boundContinueStatement.Label - Dim branchKind As BranchKind = branchKind.Continue + Dim branchKind As BranchKind = BranchKind.Continue Dim syntax As SyntaxNode = boundContinueStatement.Syntax Dim type As ITypeSymbol = Nothing Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)() @@ -1028,7 +1037,7 @@ Namespace Microsoft.CodeAnalysis.Semantics Private Function CreateBoundExitStatementOperation(boundExitStatement As BoundExitStatement) As IBranchStatement Dim target As ILabelSymbol = boundExitStatement.Label - Dim branchKind As BranchKind = branchKind.Break + Dim branchKind As BranchKind = BranchKind.Break Dim syntax As SyntaxNode = boundExitStatement.Syntax Dim type As ITypeSymbol = Nothing Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()