Update VB containing type logic, updated visitor.

上级 6d27d2bc
......@@ -139,7 +139,7 @@ public enum OperationKind
/// <summary>Indicates an <see cref="ITupleExpression"/>.</summary>
TupleExpression = 0x124,
/// <summary>Indicates an <see cref="IDynamicMemberReferenceExpression"/>.</summary>
DynamicAccessExpression = 0x125,
DynamicMemberReferenceExpression = 0x125,
// Expressions that occur only in C#.
......
......@@ -66,7 +66,7 @@ Microsoft.CodeAnalysis.OperationKind.ConversionExpression = 258 -> Microsoft.Cod
Microsoft.CodeAnalysis.OperationKind.DeclarationPattern = 1040 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.DefaultCaseClause = 1042 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.DefaultValueExpression = 512 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.DynamicAccessExpression = 293 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.DynamicMemberReferenceExpression = 293 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.EmptyStatement = 9 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.EndStatement = 81 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.EventAssignmentExpression = 283 -> Microsoft.CodeAnalysis.OperationKind
......
......@@ -645,7 +645,16 @@ Namespace Microsoft.CodeAnalysis.Semantics
If boundLateMemberAccess.TypeArgumentsOpt IsNot Nothing Then
typeArguments = ImmutableArray(Of ITypeSymbol).CastUp(boundLateMemberAccess.TypeArgumentsOpt.Arguments)
End If
Dim containingType As ITypeSymbol = boundLateMemberAccess.ContainerTypeOpt
Dim containingType As ITypeSymbol = Nothing
' If there's nothing being late-bound against, something is very wrong
Debug.Assert(boundLateMemberAccess.ReceiverOpt IsNot Nothing OrElse boundLateMemberAccess.ContainerTypeOpt IsNot Nothing)
' Only set containing type if the container is set to something, and either there is no reciever, or the receiver's type
' does not match the type of the containing type.
If (boundLateMemberAccess.ContainerTypeOpt IsNot Nothing AndAlso
(boundLateMemberAccess.ReceiverOpt Is Nothing OrElse
boundLateMemberAccess.ContainerTypeOpt <> boundLateMemberAccess.ReceiverOpt.Type)) Then
containingType = boundLateMemberAccess.ContainerTypeOpt
End If
Dim syntax As SyntaxNode = boundLateMemberAccess.Syntax
Dim type As ITypeSymbol = boundLateMemberAccess.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundLateMemberAccess.ConstantValueOpt)
......
......@@ -187,10 +187,10 @@ private void LogSymbol(ISymbol symbol, string header, bool logDisplayString = tr
LogString($"{symbolStr}");
}
private void LogType(ITypeSymbol type)
private void LogType(ITypeSymbol type, string header = "Type")
{
var typeStr = type != null ? type.ToTestDisplayString() : "null";
LogString($"Type: {typeStr}");
LogString($"{header}: {typeStr}");
}
#endregion
......@@ -1051,7 +1051,12 @@ public override void VisitParenthesizedExpression(IParenthesizedExpression opera
public override void VisitDynamicMemberReferenceExpression(IDynamicMemberReferenceExpression operation)
{
LogString(nameof(IDynamicMemberReferenceExpression));
LogString($" (Member name: {operation.MemberName}, Containing Type: {(object)operation.ContainingType ?? "null"})");
// (Member Name: "quoted name", Containing Type: type)
LogString(" (");
LogConstant((object)operation.MemberName, "Member Name");
LogString(", ");
LogType(operation.ContainingType, "Containing Type");
LogString(")");
LogCommonPropertiesAndNewLine(operation);
if (!operation.TypeArguments.IsDefaultOrEmpty)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册