提交 f2ce4b3f 编写于 作者: G Gen Lu

Address review comments

上级 1e67a4e4
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
namespace Microsoft.CodeAnalysis.CSharp namespace Microsoft.CodeAnalysis.CSharp
{ {
internal abstract class BaseCSharpArgument : BaseArgument, IArgument internal abstract class BaseCSharpArgument : BaseArgument
{ {
public BaseCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) : public BaseCSharpArgument(ArgumentKind argumentKind, IParameterSymbol parameter, SemanticModel semanticModel, SyntaxNode syntax, ITypeSymbol type, Optional<object> constantValue) :
base(argumentKind, parameter, semanticModel, syntax, type, constantValue) base(argumentKind, parameter, semanticModel, syntax, type, constantValue)
......
...@@ -19,13 +19,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ...@@ -19,13 +19,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Public Overrides ReadOnly Property InConversion As [Optional](Of CommonConversion) Public Overrides ReadOnly Property InConversion As [Optional](Of CommonConversion)
Get Get
Return If(InConversionInternal = Nothing, New [Optional](Of CommonConversion)(), InConversionInternal.ToCommonConversion()) Return If(InConversionInternal.Exists, InConversionInternal.ToCommonConversion(), New [Optional](Of CommonConversion)())
End Get End Get
End Property End Property
Public Overrides ReadOnly Property OutConversion As [Optional](Of CommonConversion) Public Overrides ReadOnly Property OutConversion As [Optional](Of CommonConversion)
Get Get
Return If(OutConversionInternal = Nothing, New [Optional](Of CommonConversion)(), OutConversionInternal.ToCommonConversion()) Return If(OutConversionInternal.Exists, OutConversionInternal.ToCommonConversion(), New [Optional](Of CommonConversion)())
End Get End Get
End Property End Property
End Class End Class
......
...@@ -74,11 +74,12 @@ Namespace Microsoft.CodeAnalysis.Semantics ...@@ -74,11 +74,12 @@ Namespace Microsoft.CodeAnalysis.Semantics
Private Function CreateConversion(expression As BoundExpression) As Conversion Private Function CreateConversion(expression As BoundExpression) As Conversion
If expression.Kind = BoundKind.Conversion Then If expression.Kind = BoundKind.Conversion Then
Dim conversion = DirectCast(expression, BoundConversion) Dim conversion = DirectCast(expression, BoundConversion)
Dim conversionKind = conversion.ConversionKind
Dim method As MethodSymbol = Nothing Dim method As MethodSymbol = Nothing
If conversion.Operand.Kind = BoundKind.UserDefinedConversion Then If conversionKind.HasFlag(VisualBasic.ConversionKind.UserDefined) AndAlso conversion.Operand.Kind = BoundKind.UserDefinedConversion Then
method = DirectCast(conversion.Operand, BoundUserDefinedConversion).Call.Method method = DirectCast(conversion.Operand, BoundUserDefinedConversion).Call.Method
End If End If
Return New Conversion(KeyValuePair.Create(conversion.ConversionKind, method)) Return New Conversion(KeyValuePair.Create(conversionKind, method))
End If End If
Return New Conversion(Nothing) 'NoConversion Return New Conversion(Nothing) 'NoConversion
End Function End Function
......
...@@ -1384,7 +1384,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ...@@ -1384,7 +1384,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' </summary> ''' </summary>
''' <param name="argument">The argument to get original info from.</param> ''' <param name="argument">The argument to get original info from.</param>
''' <returns>The underlying <see cref="Conversion"/> of the InConversion.</returns> ''' <returns>The underlying <see cref="Conversion"/> of the InConversion.</returns>
''' <exception cref="InvalidCastException">If the <see cref="IArgument"/> was not created from Visual Basic code.</exception> ''' <exception cref="ArgumentException">If the <see cref="IArgument"/> was not created from Visual Basic code.</exception>
<Extension> <Extension>
Public Function GetInConversion(argument As IArgument) As Conversion Public Function GetInConversion(argument As IArgument) As Conversion
Dim basicArgument = TryCast(argument, BaseVisualBasicArgument) Dim basicArgument = TryCast(argument, BaseVisualBasicArgument)
...@@ -1402,7 +1402,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ...@@ -1402,7 +1402,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
''' </summary> ''' </summary>
''' <param name="argument">The argument to get original info from.</param> ''' <param name="argument">The argument to get original info from.</param>
''' <returns>The underlying <see cref="Conversion"/> of the OutConversion.</returns> ''' <returns>The underlying <see cref="Conversion"/> of the OutConversion.</returns>
''' <exception cref="InvalidCastException">If the <see cref="IArgument"/> was not created from Visual Basic code.</exception> ''' <exception cref="ArgumentException">If the <see cref="IArgument"/> was not created from Visual Basic code.</exception>
<Extension> <Extension>
Public Function GetOutConversion(argument As IArgument) As Conversion Public Function GetOutConversion(argument As IArgument) As Conversion
Dim basicArgument = TryCast(argument, BaseVisualBasicArgument) Dim basicArgument = TryCast(argument, BaseVisualBasicArgument)
......
...@@ -758,8 +758,6 @@ BC30272: 'y' is not a parameter of 'Public Sub M2(x As Integer)'. ...@@ -758,8 +758,6 @@ BC30272: 'y' is not a parameter of 'Public Sub M2(x As Integer)'.
VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics) VerifyOperationTreeAndDiagnosticsForTest(Of InvocationExpressionSyntax)(source, expectedOperationTree, expectedDiagnostics)
End Sub End Sub
<CompilerTrait(CompilerFeature.IOperation)> <CompilerTrait(CompilerFeature.IOperation)>
<Fact> <Fact>
Public Sub InOutConversion() Public Sub InOutConversion()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册