提交 aaa64eba 编写于 作者: J Jan Hindermann

Use directive trivia classification method

上级 8c067991
...@@ -263,20 +263,16 @@ private void ClassifyPragmaWarningDirective(PragmaWarningDirectiveTriviaSyntax n ...@@ -263,20 +263,16 @@ private void ClassifyPragmaWarningDirective(PragmaWarningDirectiveTriviaSyntax n
AddClassification(node.WarningKeyword, ClassificationTypeNames.PreprocessorKeyword); AddClassification(node.WarningKeyword, ClassificationTypeNames.PreprocessorKeyword);
AddClassification(node.DisableOrRestoreKeyword, ClassificationTypeNames.PreprocessorKeyword); AddClassification(node.DisableOrRestoreKeyword, ClassificationTypeNames.PreprocessorKeyword);
// Comments after a "#pragma warning" directive without any error codes are trailing trivia of the "disable"/"restore" token. foreach (var nodeOrToken in node.ErrorCodes.GetWithSeparators())
foreach (var syntaxTrivia in node.DisableOrRestoreKeyword.TrailingTrivia)
{ {
if (syntaxTrivia.Kind() == SyntaxKind.WhitespaceTrivia) ClassifyNodeOrToken(nodeOrToken);
{
// Skip the initial whitespace
continue;
}
ClassifyToken(syntaxTrivia.Token);
} }
foreach (var nodeOrToken in node.ErrorCodes.GetWithSeparators()) if (node.ErrorCodes.Count == 0)
{ {
ClassifyNodeOrToken(nodeOrToken); // When there are no error codes, we need to classify the directive's trivia.
// (When there are error codes, ClassifyNodeOrToken above takes care of that.)
ClassifyDirectiveTrivia(node);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册