Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
46485bb3
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
46485bb3
编写于
4月 17, 2014
作者:
P
Pilchie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make our use of DebuggerDisplayAttribute more consistent (changeset 1234216)
上级
006e5f1b
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
44 addition
and
60 deletion
+44
-60
Src/Workspaces/Core/FindSymbols/ReferenceLocation.cs
Src/Workspaces/Core/FindSymbols/ReferenceLocation.cs
+3
-7
Src/Workspaces/Core/FindSymbols/ReferencedSymbol.cs
Src/Workspaces/Core/FindSymbols/ReferencedSymbol.cs
+5
-8
Src/Workspaces/Core/FindSymbols/SymbolTree/SymbolTreeInfo.Node.cs
...spaces/Core/FindSymbols/SymbolTree/SymbolTreeInfo.Node.cs
+6
-1
Src/Workspaces/Core/Workspace/Solution/Document.cs
Src/Workspaces/Core/Workspace/Solution/Document.cs
+3
-7
Src/Workspaces/Core/Workspace/Solution/DocumentId.cs
Src/Workspaces/Core/Workspace/Solution/DocumentId.cs
+4
-4
Src/Workspaces/Core/Workspace/Solution/DocumentState.cs
Src/Workspaces/Core/Workspace/Solution/DocumentState.cs
+1
-1
Src/Workspaces/Core/Workspace/Solution/Project.cs
Src/Workspaces/Core/Workspace/Solution/Project.cs
+3
-7
Src/Workspaces/Core/Workspace/Solution/ProjectId.cs
Src/Workspaces/Core/Workspace/Solution/ProjectId.cs
+4
-4
Src/Workspaces/Core/Workspace/Solution/ProjectReference.cs
Src/Workspaces/Core/Workspace/Solution/ProjectReference.cs
+3
-7
Src/Workspaces/Core/Workspace/Solution/SolutionId.cs
Src/Workspaces/Core/Workspace/Solution/SolutionId.cs
+3
-3
Src/Workspaces/Core/Workspace/WorkspaceDiagnostic.cs
Src/Workspaces/Core/Workspace/WorkspaceDiagnostic.cs
+5
-7
Src/Workspaces/CoreTest/ReferencedSymbolTests.cs
Src/Workspaces/CoreTest/ReferencedSymbolTests.cs
+3
-3
Src/Workspaces/CoreTest/SolutionTests.cs
Src/Workspaces/CoreTest/SolutionTests.cs
+1
-1
未找到文件。
Src/Workspaces/Core/FindSymbols/ReferenceLocation.cs
浏览文件 @
46485bb3
...
...
@@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.FindSymbols
/// <summary>
/// Information about a reference to a symbol.
/// </summary>
[
DebuggerDisplay
(
"{
DebuggerDisplay
,nq}"
)]
[
DebuggerDisplay
(
"{
GetDebuggerDisplay()
,nq}"
)]
public
struct
ReferenceLocation
:
IComparable
<
ReferenceLocation
>,
IEquatable
<
ReferenceLocation
>
{
/// <summary>
...
...
@@ -113,13 +113,9 @@ public int CompareTo(ReferenceLocation other)
return
0
;
}
[
DebuggerBrowsable
(
DebuggerBrowsableState
.
Never
)]
private
string
DebuggerDisplay
private
string
GetDebuggerDisplay
()
{
get
{
return
string
.
Format
(
"{0}: {1}"
,
this
.
Document
.
Name
,
this
.
Location
);
}
return
string
.
Format
(
"{0}: {1}"
,
this
.
Document
.
Name
,
this
.
Location
);
}
}
}
\ No newline at end of file
Src/Workspaces/Core/FindSymbols/ReferencedSymbol.cs
浏览文件 @
46485bb3
...
...
@@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.FindSymbols
/// how C# and VB allow a symbol to be both a definition and a reference at the same time (for
/// example, a method which implements an interface method).
/// </summary>
[
DebuggerDisplay
(
"{
DebuggerDisplay
,nq}"
)]
[
DebuggerDisplay
(
"{
GetDebuggerDisplay()
,nq}"
)]
public
class
ReferencedSymbol
{
/// <summary>
...
...
@@ -34,14 +34,11 @@ internal ReferencedSymbol(ISymbol definition, IEnumerable<ReferenceLocation> loc
this
.
Locations
=
(
locations
??
SpecializedCollections
.
EmptyEnumerable
<
ReferenceLocation
>()).
ToReadOnlyCollection
();
}
[
DebuggerBrowsable
(
DebuggerBrowsableState
.
Never
)]
internal
string
DebuggerDisplay
/// <remarks>Internal for testing purposes</remarks>
internal
string
GetDebuggerDisplay
()
{
get
{
var
count
=
this
.
Locations
.
Count
();
return
string
.
Format
(
"{0}, {1} {2}"
,
this
.
Definition
.
Name
,
count
,
count
==
1
?
"ref"
:
"refs"
);
}
var
count
=
this
.
Locations
.
Count
();
return
string
.
Format
(
"{0}, {1} {2}"
,
this
.
Definition
.
Name
,
count
,
count
==
1
?
"ref"
:
"refs"
);
}
}
}
Src/Workspaces/Core/FindSymbols/SymbolTree/SymbolTreeInfo.Node.cs
浏览文件 @
46485bb3
...
...
@@ -10,7 +10,7 @@ internal partial class SymbolTreeInfo
/// A node represents a single unique name in a dotted-name tree.
/// Uniqueness is always case sensitive.
/// </summary>
[
DebuggerDisplay
(
"{
Name,nq}, {ParentIndex
}"
)]
[
DebuggerDisplay
(
"{
GetDebuggerDisplay(),nq
}"
)]
private
struct
Node
{
private
readonly
string
name
;
...
...
@@ -43,6 +43,11 @@ public bool IsEquivalent(Node node)
{
return
(
node
.
Name
==
this
.
Name
)
&&
(
node
.
ParentIndex
==
this
.
ParentIndex
);
}
private
string
GetDebuggerDisplay
()
{
return
name
+
", "
+
parentIndex
;
}
}
}
}
\ No newline at end of file
Src/Workspaces/Core/Workspace/Solution/Document.cs
浏览文件 @
46485bb3
...
...
@@ -17,7 +17,7 @@ namespace Microsoft.CodeAnalysis
/// Represents a source code document that is part of a project.
/// It provides access to the source text, parsed syntax tree and the corresponding semantic model.
/// </summary>
[
DebuggerDisplay
(
"{
DebuggerDisplay
,nq}"
)]
[
DebuggerDisplay
(
"{
GetDebuggerDisplay()
,nq}"
)]
public
partial
class
Document
{
private
readonly
DocumentState
state
;
...
...
@@ -470,13 +470,9 @@ internal async Task<Document> WithFrozenPartialSemanticsAsync(CancellationToken
}
}
[
DebuggerBrowsable
(
DebuggerBrowsableState
.
Never
)]
private
string
DebuggerDisplay
private
string
GetDebuggerDisplay
()
{
get
{
return
this
.
Name
;
}
return
this
.
Name
;
}
}
}
\ No newline at end of file
Src/Workspaces/Core/Workspace/Solution/DocumentId.cs
浏览文件 @
46485bb3
...
...
@@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis
/// An identifier that can be used to retrieve the same Document across versions of the
/// workspace.
/// </summary>
[
DebuggerDisplay
(
"{
DebuggerText
}"
)]
[
DebuggerDisplay
(
"{
GetDebuggerDisplay(),nq
}"
)]
[
Serializable
]
public
class
DocumentId
:
IEquatable
<
DocumentId
>
{
...
...
@@ -44,14 +44,14 @@ public static DocumentId CreateNewId(ProjectId projectId, string debugName = nul
return
new
DocumentId
(
projectId
,
debugName
);
}
internal
string
DebuggerText
internal
string
GetDebuggerDisplay
()
{
get
{
return
string
.
Format
(
"({0}, #{1} - {2})"
,
this
.
GetType
().
Name
,
this
.
Id
,
this
.
debugName
);
}
return
string
.
Format
(
"({0}, #{1} - {2})"
,
this
.
GetType
().
Name
,
this
.
Id
,
this
.
debugName
);
}
public
override
string
ToString
()
{
return
DebuggerText
;
return
GetDebuggerDisplay
()
;
}
public
override
bool
Equals
(
object
obj
)
...
...
Src/Workspaces/Core/Workspace/Solution/DocumentState.cs
浏览文件 @
46485bb3
...
...
@@ -121,7 +121,7 @@ private static async Task<TextAndVersion> LoadTextAsync(TextLoader loader, Docum
catch
(
Exception
e
)
{
services
.
Workspace
.
OnWorkspaceFailed
(
new
DocumentDiagnostic
(
WorkspaceDiagnosticKind
.
FileAccessFailure
,
e
.
Message
,
documentId
));
return
TextAndVersion
.
Create
(
SourceText
.
From
(
string
.
Empty
),
VersionStamp
.
Default
,
documentId
.
DebuggerText
);
return
TextAndVersion
.
Create
(
SourceText
.
From
(
string
.
Empty
),
VersionStamp
.
Default
,
documentId
.
GetDebuggerDisplay
()
);
}
}
...
...
Src/Workspaces/Core/Workspace/Solution/Project.cs
浏览文件 @
46485bb3
...
...
@@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis
/// <summary>
/// Represents a project that is part of a solution.
/// </summary>
[
DebuggerDisplay
(
"{
DebuggerDisplay
,nq}"
)]
[
DebuggerDisplay
(
"{
GetDebuggerDisplay()
,nq}"
)]
public
partial
class
Project
{
private
readonly
Solution
solution
;
...
...
@@ -548,13 +548,9 @@ public Project RemoveDocument(DocumentId documentId)
return
this
.
Solution
.
RemoveDocument
(
documentId
).
GetProject
(
this
.
Id
);
}
[
DebuggerBrowsable
(
DebuggerBrowsableState
.
Never
)]
private
string
DebuggerDisplay
private
string
GetDebuggerDisplay
()
{
get
{
return
this
.
Name
;
}
return
this
.
Name
;
}
}
}
\ No newline at end of file
Src/Workspaces/Core/Workspace/Solution/ProjectId.cs
浏览文件 @
46485bb3
...
...
@@ -12,7 +12,7 @@ namespace Microsoft.CodeAnalysis
/// <summary>
/// An identifier that can be used to refer to the same Project across versions.
/// </summary>
[
DebuggerDisplay
(
"{
DebuggerText
}"
)]
[
DebuggerDisplay
(
"{
GetDebuggerDisplay(),nq
}"
)]
[
Serializable
]
public
class
ProjectId
:
IEquatable
<
ProjectId
>
{
...
...
@@ -43,14 +43,14 @@ public static ProjectId CreateNewId(string debugName = null)
return
new
ProjectId
(
debugName
);
}
private
string
DebuggerText
private
string
GetDebuggerDisplay
()
{
get
{
return
string
.
Format
(
"({0}, #{1} - {2})"
,
this
.
GetType
().
Name
,
this
.
Id
,
this
.
debugName
);
}
return
string
.
Format
(
"({0}, #{1} - {2})"
,
this
.
GetType
().
Name
,
this
.
Id
,
this
.
debugName
);
}
public
override
string
ToString
()
{
return
DebuggerText
;
return
GetDebuggerDisplay
()
;
}
public
override
bool
Equals
(
object
obj
)
...
...
Src/Workspaces/Core/Workspace/Solution/ProjectReference.cs
浏览文件 @
46485bb3
...
...
@@ -10,7 +10,7 @@
namespace
Microsoft.CodeAnalysis
{
[
Serializable
]
[
DebuggerDisplay
(
"{
DebuggerDisplay
,nq}"
)]
[
DebuggerDisplay
(
"{
GetDebuggerDisplay()
,nq}"
)]
public
sealed
class
ProjectReference
:
IEquatable
<
ProjectReference
>
{
private
readonly
ProjectId
projectId
;
...
...
@@ -62,13 +62,9 @@ public override int GetHashCode()
return
Hash
.
CombineValues
(
aliases
,
Hash
.
Combine
(
projectId
,
embedInteropTypes
.
GetHashCode
()));
}
[
DebuggerBrowsable
(
DebuggerBrowsableState
.
Never
)]
private
string
DebuggerDisplay
private
string
GetDebuggerDisplay
()
{
get
{
return
this
.
projectId
.
ToString
();
}
return
this
.
projectId
.
ToString
();
}
}
}
Src/Workspaces/Core/Workspace/Solution/SolutionId.cs
浏览文件 @
46485bb3
...
...
@@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis
/// <summary>
/// An identifier that can be used to refer to the same Solution across versions.
/// </summary>
[
DebuggerDisplay
(
"{
DebuggerText
}"
)]
[
DebuggerDisplay
(
"{
GetDebuggerDisplay(),nq
}"
)]
[
Serializable
]
public
class
SolutionId
:
IEquatable
<
SolutionId
>
{
...
...
@@ -39,9 +39,9 @@ public static SolutionId CreateNewId(string debugName = null)
return
new
SolutionId
(
debugName
);
}
private
string
DebuggerText
private
string
GetDebuggerDisplay
()
{
get
{
return
string
.
Format
(
"({0}, #{1} - {2})"
,
GetType
().
Name
,
this
.
Id
,
this
.
debugName
);
}
return
string
.
Format
(
"({0}, #{1} - {2})"
,
GetType
().
Name
,
this
.
Id
,
this
.
debugName
);
}
public
override
bool
Equals
(
object
obj
)
...
...
Src/Workspaces/Core/Workspace/WorkspaceDiagnostic.cs
浏览文件 @
46485bb3
...
...
@@ -4,7 +4,7 @@
namespace
Microsoft.CodeAnalysis
{
[
DebuggerDisplay
(
"{
DebuggerText
,nq}"
)]
[
DebuggerDisplay
(
"{
GetDebuggerDisplay()
,nq}"
)]
public
abstract
class
WorkspaceDiagnostic
{
public
WorkspaceDiagnosticKind
Kind
{
get
;
private
set
;
}
...
...
@@ -18,15 +18,13 @@ public WorkspaceDiagnostic(WorkspaceDiagnosticKind kind, string message)
public
override
string
ToString
()
{
return
DebuggerText
;
return
GetDebuggerDisplay
()
;
}
internal
string
DebuggerText
/// <remarks>Internal for testing purposes</remarks>
internal
string
GetDebuggerDisplay
()
{
get
{
return
string
.
Format
(
"[{0}] {1}"
,
this
.
Kind
.
ToString
(),
this
.
Message
);
}
return
string
.
Format
(
"[{0}] {1}"
,
this
.
Kind
.
ToString
(),
this
.
Message
);
}
}
}
\ No newline at end of file
Src/Workspaces/CoreTest/ReferencedSymbolTests.cs
浏览文件 @
46485bb3
...
...
@@ -19,7 +19,7 @@ public void DebuggerDisplay_OneReference()
{
ReferencedSymbol
referencedSymbol
=
CreateReferencedSymbol
(
"Foo"
,
1
);
Assert
.
Equal
(
"Foo, 1 ref"
,
referencedSymbol
.
DebuggerDisplay
);
Assert
.
Equal
(
"Foo, 1 ref"
,
referencedSymbol
.
GetDebuggerDisplay
()
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
FindReferences
)]
...
...
@@ -27,7 +27,7 @@ public void DebuggerDisplay_NoReferences()
{
ReferencedSymbol
referencedSymbol
=
CreateReferencedSymbol
(
"Foo"
,
0
);
Assert
.
Equal
(
"Foo, 0 refs"
,
referencedSymbol
.
DebuggerDisplay
);
Assert
.
Equal
(
"Foo, 0 refs"
,
referencedSymbol
.
GetDebuggerDisplay
()
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
FindReferences
)]
...
...
@@ -35,7 +35,7 @@ public void DebuggerDisplay_TwoReferences()
{
ReferencedSymbol
referencedSymbol
=
CreateReferencedSymbol
(
"Foo"
,
2
);
Assert
.
Equal
(
"Foo, 2 refs"
,
referencedSymbol
.
DebuggerDisplay
);
Assert
.
Equal
(
"Foo, 2 refs"
,
referencedSymbol
.
GetDebuggerDisplay
()
);
}
private
static
ReferencedSymbol
CreateReferencedSymbol
(
string
symbolName
,
int
referenceCount
)
...
...
Src/Workspaces/CoreTest/SolutionTests.cs
浏览文件 @
46485bb3
...
...
@@ -1266,7 +1266,7 @@ public void TestWorkspaceDiagnosticHasDebuggerText()
Assert
.
NotNull
(
diagnostic
);
var
dd
=
diagnostic
as
DocumentDiagnostic
;
Assert
.
NotNull
(
dd
);
Assert
.
Equal
(
dd
.
DebuggerText
,
string
.
Format
(
"[{0}] {1}"
,
dd
.
Kind
.
ToString
(),
dd
.
Message
));
Assert
.
Equal
(
dd
.
GetDebuggerDisplay
()
,
string
.
Format
(
"[{0}] {1}"
,
dd
.
Kind
.
ToString
(),
dd
.
Message
));
}
private
bool
WaitFor
(
Func
<
bool
>
condition
,
TimeSpan
timeout
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录