提交 f86859e7 编写于 作者: H Heejae Chang

put both partial method symbol to event queue.

上级 cf3206d2
......@@ -1030,8 +1030,7 @@ public override object VisitField(FieldSymbol symbol, TypeCompilationState argum
return semanticModel;
});
MethodSymbol symbolToProduce = methodSymbol.PartialDefinitionPart ?? methodSymbol;
_compilation.EventQueue.TryEnqueue(new SymbolDeclaredCompilationEvent(_compilation, symbolToProduce, lazySemanticModel));
_compilation.EventQueue.TryEnqueue(new SymbolDeclaredCompilationEvent(_compilation, methodSymbol, lazySemanticModel));
}
// Don't lower if we're not emitting or if there were errors.
......
......@@ -271,9 +271,10 @@ private static bool DequeueCompilationEvents(AsyncQueue<CompilationEvent> eventQ
{
var symbol = symbolDeclaredEvent.Symbol;
var added = declaredSymbolNames.Add(symbol.Name);
Assert.True(added, "Unexpected multiple symbol declared events for symbol " + symbol);
var method = symbol as Symbols.MethodSymbol;
Assert.Null(method?.PartialDefinitionPart); // we should never get a partial method's implementation part
if (!added)
{
Assert.True(((Symbols.SourceMemberMethodSymbol)symbol).IsPartial, "Unexpected multiple symbol declared events for symbol " + symbol);
}
}
else
{
......@@ -293,7 +294,7 @@ private static bool DequeueCompilationEvents(AsyncQueue<CompilationEvent> eventQ
public void TestEventQueueCompletionForEmptyCompilation()
{
var compilation = CreateCompilationWithMscorlib45(SpecializedCollections.EmptyEnumerable<SyntaxTree>()).WithEventQueue(new AsyncQueue<CompilationEvent>());
// Force complete compilation event queue
var unused = compilation.GetDiagnostics();
......
......@@ -1222,8 +1222,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End If
Return semanticModel
End Function)
Dim symbolToProduce = If(method.PartialDefinitionPart, method)
compilation.EventQueue.TryEnqueue(New SymbolDeclaredCompilationEvent(compilation, symbolToProduce, lazySemanticModel))
compilation.EventQueue.TryEnqueue(New SymbolDeclaredCompilationEvent(compilation, method, lazySemanticModel))
End If
End If
End If
......
' 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 System.Xml.Linq
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Roslyn.Test.Utilities
......@@ -424,9 +423,10 @@ BC31030: Conditional compilation constant '2' is not valid: Identifier expected.
Dim symbolDeclaredEvent = TryCast(compEvent, SymbolDeclaredCompilationEvent)
If symbolDeclaredEvent IsNot Nothing Then
Dim symbol = symbolDeclaredEvent.Symbol
Assert.True(declaredSymbolNames.Add(symbol.Name), "Unexpected multiple symbol declared events for same symbol")
Dim method = TryCast(symbol, Symbols.MethodSymbol)
Assert.Null(method?.PartialDefinitionPart) ' we should never get a partial method's implementation part
Dim added = declaredSymbolNames.Add(symbol.Name)
If Not added Then
Assert.True(DirectCast(symbol, Symbols.SourceMethodSymbol).IsPartial, "Unexpected multiple symbol declared events for same symbol " + symbol.Name)
End If
Else
Dim compilationCompeletedEvent = TryCast(compEvent, CompilationUnitCompletedEvent)
If compilationCompeletedEvent IsNot Nothing Then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册