提交 fa70f514 编写于 作者: C Cyrus Najmabadi

Make VB 'GetEntryPoint' sit on top of GetSymbolsWithName

上级 def0e3aa
......@@ -2,10 +2,7 @@
Imports System.Threading
Imports Microsoft.CodeAnalysis.PooledObjects
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic
......@@ -23,8 +20,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Sub
Private Sub New(entryPointCandidates As ArrayBuilder(Of MethodSymbol),
visitNestedTypes As Boolean,
cancellationToken As CancellationToken)
visitNestedTypes As Boolean,
cancellationToken As CancellationToken)
Me._entryPointCandidates = entryPointCandidates
Me._visitNestedTypes = visitNestedTypes
......@@ -64,8 +61,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ElseIf member.Kind = SymbolKind.Method Then
Dim method = DirectCast(member, MethodSymbol)
' check if this is an entry point
If Not method.IsSubmissionConstructor AndAlso _entryPointCandidates IsNot Nothing AndAlso Not method.IsImplicitlyDeclared AndAlso method.IsEntryPointCandidate Then
If _entryPointCandidates IsNot Nothing AndAlso method.IsEntryPointCandidate Then
_entryPointCandidates.Add(method)
End If
End If
......
......@@ -1468,8 +1468,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
mainType = Nothing
errorTarget = Me.AssemblyName
EntryPointCandidateFinder.FindCandidatesInNamespace(globalNamespace, entryPointCandidates, cancellationToken)
entryPointCandidates.AddRange(
Me.GetSymbolsWithName(WellKnownMemberNames.EntryPointMethodName, SymbolFilter.Member, cancellationToken).
OfType(Of MethodSymbol).
Where(Function(m) m.IsEntryPointCandidate))
' Global code is the entry point, ignore all other Mains.
If ScriptClass IsNot Nothing Then
......
......@@ -448,6 +448,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
''' <returns>True if the method can be used as an entry point.</returns>
Friend ReadOnly Property IsEntryPointCandidate As Boolean
Get
If Me.ContainingType.IsEmbedded Then
Return False
End If
If Me.IsSubmissionConstructor Then
Return False
End If
If Me.IsImplicitlyDeclared Then
Return False
End If
Return String.Equals(Name, WellKnownMemberNames.EntryPointMethodName, StringComparison.OrdinalIgnoreCase)
End Get
End Property
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册