Added BoundAddressOf.Children implementation for VB.

上级 b3cacb02
......@@ -29,6 +29,26 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Property
End Class
Partial Friend Class BoundAddressOfOperator
Protected Overrides ReadOnly Property Children As ImmutableArray(Of BoundNode)
Get
Return ImmutableArray.Create(Of BoundNode)(Me.MethodGroup)
End Get
End Property
End Class
Partial Friend Class BoundMethodGroup
Protected Overrides ReadOnly Property Children As ImmutableArray(Of BoundNode)
Get
If Me.TypeArgumentsOpt IsNot Nothing Then
Return ImmutableArray.Create(Of BoundNode)(Me.TypeArgumentsOpt)
Else
Return ImmutableArray(Of BoundNode).Empty
End If
End Get
End Property
End Class
Partial Friend Class BoundCaseBlock
Protected Overrides ReadOnly Property Children As ImmutableArray(Of BoundNode)
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.
' 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.VisualBasic.Syntax
......@@ -1030,6 +1030,8 @@ IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclaratio
Initializer: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Action, IsInvalid) (Syntax: 'AddressOf M2')
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: IOperation: (OperationKind.None, IsInvalid) (Syntax: 'AddressOf M2')
Children(1):
IOperation: (OperationKind.None, IsInvalid) (Syntax: 'M2')
]]>.Value
Dim expectedDiagnostics = <![CDATA[
......@@ -1119,6 +1121,8 @@ IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclaratio
Initializer: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Func(Of System.Int64), IsInvalid) (Syntax: 'AddressOf M2')
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: IOperation: (OperationKind.None, IsInvalid) (Syntax: 'AddressOf M2')
Children(1):
IOperation: (OperationKind.None, IsInvalid) (Syntax: 'M2')
]]>.Value
Dim expectedDiagnostics = <![CDATA[
......@@ -2348,6 +2352,33 @@ IVariableDeclarationStatement (1 declarations) (OperationKind.VariableDeclaratio
VerifyOperationTreeAndDiagnosticsForTest(Of LocalDeclarationStatementSyntax)(source, expectedOperationTree, expectedDiagnostics)
End Sub
<CompilerTrait(CompilerFeature.IOperation)>
<Fact()>
Public Sub ConversionExpression_Implicit_WideningMethodGroupToDelegate_InvalidGenericArguments()
Dim source = <![CDATA[
Option Strict On
Imports System
Module M1
Sub Method1()
Dim a As Action(Of String) = AddressOf Method2(Of String)'BIND:"AddressOf Method2(Of String)"
End Sub
Sub Method2(arg As Object)
End Sub
End Module]]>.Value
Dim expectedOperationTree = <![CDATA[
]]>.Value
Dim expectedDiagnostics = <![CDATA[
BC32045: 'Public Sub Method2(arg As Object)' has no type parameters and so cannot have type arguments.
Dim a As Action(Of String) = AddressOf Method2(Of String)'BIND:"AddressOf Method2(Of String)"
~~~~~~~~~~~
]]>.Value
VerifyOperationTreeAndDiagnosticsForTest(Of UnaryExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics)
End Sub
#End Region
Private Class ExpectedSymbolVerifier
......
......@@ -167,6 +167,8 @@ IExpressionStatement (OperationKind.ExpressionStatement, IsInvalid) (Syntax: 'Re
Handler: IConversionExpression (Implicit, TryCast: False, Unchecked) (OperationKind.ConversionExpression, Type: System.Action, IsInvalid) (Syntax: 'AddressOf M')
Conversion: CommonConversion (Exists: False, IsIdentity: False, IsNumeric: False, IsReference: False, IsUserDefined: False) (MethodSymbol: null)
Operand: IOperation: (OperationKind.None, IsInvalid) (Syntax: 'AddressOf M')
Children(1):
IOperation: (OperationKind.None, IsInvalid) (Syntax: 'M')
]]>.Value
Dim expectedDiagnostics = <![CDATA[
......
......@@ -812,6 +812,8 @@ IAnonymousObjectCreationExpression (OperationKind.AnonymousObjectCreationExpress
Right: IInvalidExpression (OperationKind.InvalidExpression, Type: ?, IsInvalid) (Syntax: 'AddressOf S')
Children(1):
IOperation: (OperationKind.None, IsInvalid) (Syntax: 'AddressOf S')
Children(1):
IOperation: (OperationKind.None, IsInvalid) (Syntax: 'S')
]]>.Value
Dim expectedDiagnostics = <![CDATA[
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册