Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
044c1692
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,发现更多精彩内容 >>
提交
044c1692
编写于
6月 04, 2015
作者:
T
Tomas Matousek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Report rude edit when a partially executed active statement is edited
上级
6b0f3c0b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
89 addition
and
2 deletion
+89
-2
src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs
...atures/CSharpTest/EditAndContinue/ActiveStatementTests.cs
+39
-0
src/EditorFeatures/Test/EditAndContinue/RudeEditDiagnosticTests.cs
...rFeatures/Test/EditAndContinue/RudeEditDiagnosticTests.cs
+1
-0
src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb
...s/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb
+36
-0
src/Features/Core/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
...s/Core/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
+3
-2
src/Features/Core/EditAndContinue/ActiveStatementFlags.cs
src/Features/Core/EditAndContinue/ActiveStatementFlags.cs
+7
-0
src/Features/Core/EditAndContinue/RudeEditDiagnosticDescriptors.cs
...res/Core/EditAndContinue/RudeEditDiagnosticDescriptors.cs
+2
-0
src/Features/Core/EditAndContinue/RudeEditKind.cs
src/Features/Core/EditAndContinue/RudeEditKind.cs
+1
-0
未找到文件。
src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs
浏览文件 @
044c1692
...
...
@@ -7648,6 +7648,45 @@ static void Foo(int a)
Diagnostic
(
RudeEditKind
.
Delete
,
null
,
FeaturesResources
.
Class
));
}
[
Fact
]
public
void
PartiallyExecutedActiveStatement
()
{
string
src1
=
@"
class C
{
public static void F()
{
<AS:0>Console.WriteLine(1);</AS:0>
<AS:1>Console.WriteLine(2);</AS:1>
<AS:2>Console.WriteLine(3);</AS:2>
<AS:3>Console.WriteLine(4);</AS:3>
}
}"
;
string
src2
=
@"
class C
{
public static void F()
{
<AS:0>Console.WriteLine(10);</AS:0>
<AS:1>Console.WriteLine(20);</AS:1>
<AS:2>Console.WriteLine(30);</AS:2>
<AS:3>Console.WriteLine(40);</AS:3>
}
}"
;
var
edits
=
GetTopEdits
(
src1
,
src2
);
var
active
=
GetActiveStatements
(
src1
,
src2
);
active
.
OldSpans
[
0
]
=
new
ActiveStatementSpan
(
ActiveStatementFlags
.
PartiallyExecuted
|
ActiveStatementFlags
.
LeafFrame
,
active
.
OldSpans
[
0
].
Span
);
active
.
OldSpans
[
1
]
=
new
ActiveStatementSpan
(
ActiveStatementFlags
.
PartiallyExecuted
,
active
.
OldSpans
[
1
].
Span
);
active
.
OldSpans
[
2
]
=
new
ActiveStatementSpan
(
ActiveStatementFlags
.
LeafFrame
,
active
.
OldSpans
[
2
].
Span
);
active
.
OldSpans
[
3
]
=
new
ActiveStatementSpan
(
ActiveStatementFlags
.
None
,
active
.
OldSpans
[
3
].
Span
);
edits
.
VerifyRudeDiagnostics
(
active
,
Diagnostic
(
RudeEditKind
.
PartiallyExecutedActiveStatementUpdate
,
"Console.WriteLine(10);"
),
Diagnostic
(
RudeEditKind
.
ActiveStatementUpdate
,
"Console.WriteLine(20);"
),
Diagnostic
(
RudeEditKind
.
ActiveStatementUpdate
,
"Console.WriteLine(40);"
));
}
#
endregion
}
}
src/EditorFeatures/Test/EditAndContinue/RudeEditDiagnosticTests.cs
浏览文件 @
044c1692
...
...
@@ -22,6 +22,7 @@ public void ToDiagnostic()
var
arg0
=
new
HashSet
<
RudeEditKind
>()
{
RudeEditKind
.
ActiveStatementUpdate
,
RudeEditKind
.
PartiallyExecutedActiveStatementUpdate
,
RudeEditKind
.
DeleteActiveStatement
,
RudeEditKind
.
UpdateExceptionHandlerOfActiveTry
,
RudeEditKind
.
UpdateTryOrCatchWithActiveFinally
,
...
...
src/EditorFeatures/VisualBasicTest/EditAndContinue/ActiveStatementTests.vb
浏览文件 @
044c1692
...
...
@@ -4975,8 +4975,44 @@ End Module"
Extensions
.
VerifyUnchangedDocument
(
src2
,
active
)
End
Sub
#End Region
<
Fact
>
Public
Sub
PartiallyExecutedActiveStatement
()
Dim
src1
As
String
=
"
Class C
Sub F()
<AS:0>Console.WriteLine(1)</AS:0>
<AS:1>Console.WriteLine(2)</AS:1>
<AS:2>Console.WriteLine(3)</AS:2>
<AS:3>Console.WriteLine(4)</AS:3>
End Sub
End Class
"
Dim
src2
As
String
=
"
Class C
Sub F()
<AS:0>Console.WriteLine(10)</AS:0>
<AS:1>Console.WriteLine(20)</AS:1>
<AS:2>Console.WriteLine(30)</AS:2>
<AS:3>Console.WriteLine(40)</AS:3>
End Sub
End Class
"
Dim
edits
=
GetTopEdits
(
src1
,
src2
)
Dim
active
=
GetActiveStatements
(
src1
,
src2
)
active
.
OldSpans
(
0
)
=
New
ActiveStatementSpan
(
ActiveStatementFlags
.
PartiallyExecuted
Or
ActiveStatementFlags
.
LeafFrame
,
active
.
OldSpans
(
0
).
Span
)
active
.
OldSpans
(
1
)
=
New
ActiveStatementSpan
(
ActiveStatementFlags
.
PartiallyExecuted
,
active
.
OldSpans
(
1
).
Span
)
active
.
OldSpans
(
2
)
=
New
ActiveStatementSpan
(
ActiveStatementFlags
.
LeafFrame
,
active
.
OldSpans
(
2
).
Span
)
active
.
OldSpans
(
3
)
=
New
ActiveStatementSpan
(
ActiveStatementFlags
.
None
,
active
.
OldSpans
(
3
).
Span
)
edits
.
VerifyRudeDiagnostics
(
active
,
Diagnostic
(
RudeEditKind
.
PartiallyExecutedActiveStatementUpdate
,
"Console.WriteLine(10)"
),
Diagnostic
(
RudeEditKind
.
ActiveStatementUpdate
,
"Console.WriteLine(20)"
),
Diagnostic
(
RudeEditKind
.
ActiveStatementUpdate
,
"Console.WriteLine(40)"
))
End
Sub
End
Class
End
Namespace
src/Features/Core/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
浏览文件 @
044c1692
...
...
@@ -991,6 +991,7 @@ internal struct UpdatedMemberInfo
int
ordinal
=
start
+
i
;
bool
hasMatching
=
false
;
bool
isLeaf
=
(
oldActiveStatements
[
ordinal
].
Flags
&
ActiveStatementFlags
.
LeafFrame
)
!=
0
;
bool
isPartiallyExecuted
=
(
oldActiveStatements
[
ordinal
].
Flags
&
ActiveStatementFlags
.
PartiallyExecuted
)
!=
0
;
int
statementPart
=
activeNodes
[
i
].
StatementPart
;
var
oldStatementSyntax
=
activeNodes
[
i
].
OldNode
;
var
oldEnclosingLambdaBody
=
activeNodes
[
i
].
EnclosingLambdaBodyOpt
;
...
...
@@ -1036,10 +1037,10 @@ internal struct UpdatedMemberInfo
// E.g. "const" keyword is inserted into a local variable declaration with an initializer.
newSpan
=
FindClosestActiveSpan
(
newStatementSyntax
,
statementPart
);
if
(
!
isLeaf
&&
!
AreEquivalentActiveStatements
(
oldStatementSyntax
,
newStatementSyntax
,
statementPart
))
if
(
(!
isLeaf
||
isPartiallyExecuted
)
&&
!
AreEquivalentActiveStatements
(
oldStatementSyntax
,
newStatementSyntax
,
statementPart
))
{
// rude edit: internal active statement changed
diagnostics
.
Add
(
new
RudeEditDiagnostic
(
RudeEditKind
.
ActiveStatementUpdate
,
newSpan
));
diagnostics
.
Add
(
new
RudeEditDiagnostic
(
isLeaf
?
RudeEditKind
.
PartiallyExecutedActiveStatementUpdate
:
RudeEditKind
.
ActiveStatementUpdate
,
newSpan
));
}
// exception handling around the statement:
...
...
src/Features/Core/EditAndContinue/ActiveStatementFlags.cs
浏览文件 @
044c1692
...
...
@@ -17,6 +17,13 @@ internal enum ActiveStatementFlags
/// <summary>
/// The statement is partially executed.
/// </summary>
/// <remarks>
/// An active statement is partially executed if the thread is stopped in between two sequence points.
/// This may happen when the users steps trhough the code in disassembly window (stepping over machine instructions),
/// when the compiler emits a call to Debugger.Break (VB Stop statement), etc.
///
/// Partially executed active statement can't be edited.
/// </remarks>
PartiallyExecuted
=
2
,
/// <summary>
...
...
src/Features/Core/EditAndContinue/RudeEditDiagnosticDescriptors.cs
浏览文件 @
044c1692
...
...
@@ -75,6 +75,8 @@ internal static class RudeEditDiagnosticDescriptors
{
GetDescriptorPair
(
RudeEditKind
.
DeleteLambdaWithMultiScopeCapture
,
FeaturesResources
.
DeleteLambdaWithMultiScopeCapture
)
},
{
GetDescriptorPair
(
RudeEditKind
.
ActiveStatementUpdate
,
FeaturesResources
.
UpdatingAnActiveStatement
)
},
{
GetDescriptorPair
(
RudeEditKind
.
ActiveStatementLambdaRemoved
,
FeaturesResources
.
RemovingThatContainsActiveStatement
)
},
// TODO: change the error message to better explain what's going on
{
GetDescriptorPair
(
RudeEditKind
.
PartiallyExecutedActiveStatementUpdate
,
FeaturesResources
.
UpdatingAnActiveStatement
)
},
{
GetDescriptorPair
(
RudeEditKind
.
InsertFile
,
FeaturesResources
.
AddingANewFile
)
},
{
GetDescriptorPair
(
RudeEditKind
.
RUDE_EDIT_COMPLEX_QUERY_EXPRESSION
,
FeaturesResources
.
ModifyingAWhichContainsComplexQuery
)
},
...
...
src/Features/Core/EditAndContinue/RudeEditKind.cs
浏览文件 @
044c1692
...
...
@@ -87,6 +87,7 @@ internal enum RudeEditKind : ushort
InsertHandlesClause
=
70
,
InsertFile
=
71
,
PartiallyExecutedActiveStatementUpdate
=
72
,
// TODO: remove values below
RUDE_EDIT_COMPLEX_QUERY_EXPRESSION
=
0x103
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录