Revert OperationKind.None filtering, added an exception for fixed statements in C#.

上级 59d77fcd
......@@ -1058,7 +1058,11 @@ private IParameterInitializer CreateBoundParameterEqualsValueOperation(BoundPara
private IBlockStatement CreateBoundBlockOperation(BoundBlock boundBlock)
{
Lazy<ImmutableArray<IOperation>> statements =
new Lazy<ImmutableArray<IOperation>>(() => boundBlock.Statements.SelectAsArray(s => Create(s)));
new Lazy<ImmutableArray<IOperation>>(() => boundBlock.Statements.Select(s => (bound: s, operation: Create(s)))
// Filter out all OperationKind.None except fixed statements for now.
// https://github.com/dotnet/roslyn/issues/21776
.Where(s => s.operation.Kind != OperationKind.None || s.bound.Kind == BoundKind.FixedStatement)
.Select(s => s.operation).ToImmutableArray());
ImmutableArray<ILocalSymbol> locals = boundBlock.Locals.As<ILocalSymbol>();
SyntaxNode syntax = boundBlock.Syntax;
......
......@@ -982,15 +982,9 @@ 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.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.FunctionStatement AndAlso
statement.Syntax.Kind() <> SyntaxKind.GetAccessorStatement AndAlso
statement.Syntax.Kind() <> SyntaxKind.SetAccessorStatement
End Function
).Select(Function(n) Create(n)).ToImmutableArray()
' We should not be filtering OperationKind.None statements.
' https://github.com/dotnet/roslyn/issues/21776
Return boundBlock.Statements.Select(Function(n) Create(n)).Where(Function(s) s.Kind <> OperationKind.None).ToImmutableArray()
End Function)
Dim locals As ImmutableArray(Of ILocalSymbol) = boundBlock.Locals.As(Of ILocalSymbol)()
Dim syntax As SyntaxNode = boundBlock.Syntax
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册