Make IUsingDeclarationOperation explicit, and the underlying...

Make IUsingDeclarationOperation explicit, and the underlying IVariableDeclarationGroupOperation implicit.
上级 e89fd716
......@@ -1753,8 +1753,9 @@ private IOperation CreateBoundMultipleLocalDeclarationsBaseOperation(BoundMultip
ITypeSymbol type = null;
Optional<object> constantValue = default(Optional<object>);
// If the syntax was the same, we're in a fixed statement or using statement. We make the Group operation implicit in this scenario, as the
// syntax itself is a VariableDeclaration
bool isImplicit = declarationGroupSyntax == declarationSyntax || boundMultipleLocalDeclarations.WasCompilerGenerated;
// syntax itself is a VariableDeclaration. We do this for using declarations as well, but since that doesn't have a separate parent bound
// node, we need to check the current node for that explicitly.
bool isImplicit = declarationGroupSyntax == declarationSyntax || boundMultipleLocalDeclarations.WasCompilerGenerated || boundMultipleLocalDeclarations is BoundUsingLocalDeclarations;
var variableDeclaration = new VariableDeclarationGroupOperation(ImmutableArray.Create(multiVariableDeclaration), _semanticModel, declarationGroupSyntax, type, constantValue, isImplicit);
if (boundMultipleLocalDeclarations is BoundUsingLocalDeclarations usingDecl)
......@@ -1766,7 +1767,7 @@ private IOperation CreateBoundMultipleLocalDeclarationsBaseOperation(BoundMultip
declarationGroupSyntax,
type: null,
constantValue: default,
isImplicit: true);
isImplicit: boundMultipleLocalDeclarations.WasCompilerGenerated);
}
return variableDeclaration;
......
......@@ -1472,10 +1472,11 @@ public override void VisitUsingDeclaration(IUsingDeclarationOperation operation)
{
Assert.NotNull(operation.DeclarationGroup);
AssertEx.Equal(SpecializedCollections.SingletonEnumerable(operation.DeclarationGroup), operation.Children);
Assert.True(operation.IsImplicit);
Assert.True(operation.DeclarationGroup.IsImplicit);
Assert.Null(operation.Type);
Assert.False(operation.ConstantValue.HasValue);
_ = operation.IsAsynchronous;
_ = operation.IsImplicit;
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册