提交 da5a152e 编写于 作者: W wochae

Update VB Tests for EnC StateMachines (changeset 1388514)

上级 4ba67ac3
......@@ -83,6 +83,18 @@ Module Extensions
Return DirectCast(this.GetMembers(name).Single(), NamespaceSymbol)
End Function
<Extension>
Friend Function GetFieldNames(this As ModuleSymbol, qualifiedTypeName As String) As String()
Dim type = DirectCast(this.GlobalNamespace.GetMember(qualifiedName:=qualifiedTypeName), NamedTypeSymbol)
Return type.GetMembers().OfType(Of FieldSymbol)().Select(Of String)(Function(f) f.Name).ToArray()
End Function
<Extension>
Friend Function GetFieldNamesAndTypes(this As ModuleSymbol, qualifiedTypeName As String) As String()
Dim type = DirectCast(this.GlobalNamespace.GetMember(qualifiedName:=qualifiedTypeName), NamedTypeSymbol)
Return type.GetMembers().OfType(Of FieldSymbol)().Select(Of String)(Function(f) f.Name + ": " + f.Type.ToDisplayString(SymbolDisplayFormat.TestFormat)).ToArray()
End Function
<Extension>
Friend Function GetAttribute(this As Symbol, c As NamedTypeSymbol) As VisualBasicAttributeData
Return this.GetAttributes().Where(Function(a) a.AttributeClass = c).First()
......
......@@ -84,6 +84,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Throw New NotImplementedException()
End Function
Friend Shared Function GetSyntaxMapByKind(method As MethodSymbol, ParamArray kinds As SyntaxKind()) As Func(Of SyntaxNode, SyntaxNode)
Return Function(node As SyntaxNode)
For Each kind In kinds
If node.VBKind() = kind Then
Return method.DeclaringSyntaxReferences.Single().SyntaxTree.GetRoot().DescendantNodes().Single(Function(n) n.VBKind() = kind)
End If
Next
Return Nothing
End Function
End Function
Friend Shared Function GetEquivalentNodesMap(method1 As MethodSymbol, method0 As MethodSymbol) As Func(Of SyntaxNode, SyntaxNode)
Dim tree1 = method1.Locations(0).SourceTree
Dim tree0 = method0.Locations(0).SourceTree
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册