Remove NoneOperation filtering from C#, restrict filtering to declarations in VB.

上级 06550791
......@@ -998,7 +998,7 @@ private IParameterInitializer CreateBoundParameterEqualsValueOperation(BoundPara
private IBlockStatement CreateBoundBlockOperation(BoundBlock boundBlock)
{
Lazy<ImmutableArray<IOperation>> statements =
new Lazy<ImmutableArray<IOperation>>(() => boundBlock.Statements.Select(s => Create(s)).Where(s => s.Kind != OperationKind.None).ToImmutableArray());
new Lazy<ImmutableArray<IOperation>>(() => boundBlock.Statements.Select(s => Create(s)).ToImmutableArray());
ImmutableArray<ILocalSymbol> locals = boundBlock.Locals.As<ILocalSymbol>();
SyntaxNode syntax = boundBlock.Syntax;
......
......@@ -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)()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册