提交 3b16c5be 编写于 作者: S Sam Harwell

Reorder constructors before methods

上级 11dab511
......@@ -32,6 +32,47 @@ internal struct DiagnosticAnalysisResult
private readonly ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> _nonLocals;
private readonly ImmutableArray<DiagnosticData> _others;
private DiagnosticAnalysisResult(
ProjectId projectId, VersionStamp version, ImmutableHashSet<DocumentId> documentIds, bool isEmpty, bool fromBuild)
{
ProjectId = projectId;
Version = version;
DocumentIds = documentIds;
IsEmpty = isEmpty;
FromBuild = fromBuild;
_syntaxLocals = null;
_semanticLocals = null;
_nonLocals = null;
_others = default;
}
private DiagnosticAnalysisResult(
ProjectId projectId, VersionStamp version,
ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> syntaxLocals,
ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> semanticLocals,
ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> nonLocals,
ImmutableArray<DiagnosticData> others,
ImmutableHashSet<DocumentId> documentIds,
bool fromBuild)
{
ProjectId = projectId;
Version = version;
FromBuild = fromBuild;
_syntaxLocals = syntaxLocals;
_semanticLocals = semanticLocals;
_nonLocals = nonLocals;
_others = others;
DocumentIds = documentIds;
IsEmpty = false;
// do after all fields are assigned.
DocumentIds = DocumentIds ?? CreateDocumentIds();
IsEmpty = DocumentIds.IsEmpty && _others.IsEmpty;
}
public static DiagnosticAnalysisResult CreateEmpty(ProjectId projectId, VersionStamp version)
{
return new DiagnosticAnalysisResult(
......@@ -114,47 +155,6 @@ public static DiagnosticAnalysisResult CreateFromBuilder(DiagnosticAnalysisResul
builder.DocumentIds);
}
private DiagnosticAnalysisResult(
ProjectId projectId, VersionStamp version, ImmutableHashSet<DocumentId> documentIds, bool isEmpty, bool fromBuild)
{
ProjectId = projectId;
Version = version;
DocumentIds = documentIds;
IsEmpty = isEmpty;
FromBuild = fromBuild;
_syntaxLocals = null;
_semanticLocals = null;
_nonLocals = null;
_others = default;
}
private DiagnosticAnalysisResult(
ProjectId projectId, VersionStamp version,
ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> syntaxLocals,
ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> semanticLocals,
ImmutableDictionary<DocumentId, ImmutableArray<DiagnosticData>> nonLocals,
ImmutableArray<DiagnosticData> others,
ImmutableHashSet<DocumentId> documentIds,
bool fromBuild)
{
ProjectId = projectId;
Version = version;
FromBuild = fromBuild;
_syntaxLocals = syntaxLocals;
_semanticLocals = semanticLocals;
_nonLocals = nonLocals;
_others = others;
DocumentIds = documentIds;
IsEmpty = false;
// do after all fields are assigned.
DocumentIds = DocumentIds ?? CreateDocumentIds();
IsEmpty = DocumentIds.IsEmpty && _others.IsEmpty;
}
// aggregated form means it has aggregated information but no actual data.
public bool IsAggregatedForm => _syntaxLocals == null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册