Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
46858dd3
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,发现更多精彩内容 >>
提交
46858dd3
编写于
11月 17, 2015
作者:
A
Artur Spychaj
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6531 from drognanar/bug4230
Support removal namespace in interactive mode
上级
8f01cb09
5be1b0dd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
5 deletion
+34
-5
src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs
...atures/CSharpTest/EditAndContinue/ActiveStatementTests.cs
+23
-0
src/EditorFeatures/Test/EditAndContinue/ActiveStatementDescription.cs
...atures/Test/EditAndContinue/ActiveStatementDescription.cs
+2
-1
src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
...rtable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
+9
-4
未找到文件。
src/EditorFeatures/CSharpTest/EditAndContinue/ActiveStatementTests.cs
浏览文件 @
46858dd3
...
...
@@ -622,6 +622,29 @@ static void Foo(int a)
edits
.
VerifyRudeDiagnostics
(
active
);
}
[
WpfFact
]
public
void
Delete_EntireNamespace
()
{
string
src1
=
@"
namespace N
{
class C
{
static void Main(String[] args)
{
<AS:0>Console.WriteLine(1);</AS:0>
}
}
}"
;
string
src2
=
@"<AS:0></AS:0>"
;
var
edits
=
GetTopEdits
(
src1
,
src2
);
var
active
=
GetActiveStatements
(
src1
,
src2
);
edits
.
VerifyRudeDiagnostics
(
active
,
Diagnostic
(
RudeEditKind
.
Delete
,
null
,
"namespace"
));
}
#
endregion
#
region
Constructors
...
...
src/EditorFeatures/Test/EditAndContinue/ActiveStatementDescription.cs
浏览文件 @
46858dd3
...
...
@@ -112,7 +112,8 @@ internal static int[] GetIds(string ids)
var
ids
=
GetIds
(
match
.
Groups
[
"Id"
].
Value
);
int
absoluteOffset
=
offset
+
markedSyntax
.
Index
;
yield
return
ValueTuple
.
Create
(
new
TextSpan
(
absoluteOffset
,
markedSyntax
.
Length
),
ids
);
var
span
=
markedSyntax
.
Length
!=
0
?
new
TextSpan
(
absoluteOffset
,
markedSyntax
.
Length
)
:
new
TextSpan
();
yield
return
ValueTuple
.
Create
(
span
,
ids
);
foreach
(
var
nestedSpan
in
GetSpansRecursive
(
regex
,
contentGroupName
,
markedSyntax
.
Value
,
absoluteOffset
))
{
...
...
src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
浏览文件 @
46858dd3
...
...
@@ -554,16 +554,17 @@ private SyntaxNode FindStatement(SyntaxNode declarationBody, int position, out i
Debug
.
Assert
(
updatedMethods
.
Count
==
0
);
var
updatedTrackingSpans
=
new
List
<
KeyValuePair
<
ActiveStatementId
,
TextSpan
>>();
BitVector
editedActiveStatements
=
BitVector
.
Create
(
newActiveStatements
.
Length
);
for
(
int
i
=
0
;
i
<
script
.
Edits
.
Length
;
i
++)
{
var
edit
=
script
.
Edits
[
i
];
AnalyzeUpdatedActiveMethodBodies
(
script
,
i
,
editMap
,
oldText
,
newText
,
documentId
,
trackingService
,
oldActiveStatements
,
newActiveStatements
,
newExceptionRegions
,
updatedMethods
,
updatedTrackingSpans
,
diagnostics
);
AnalyzeUpdatedActiveMethodBodies
(
script
,
i
,
editMap
,
oldText
,
newText
,
documentId
,
trackingService
,
oldActiveStatements
,
ref
editedActiveStatements
,
newActiveStatements
,
newExceptionRegions
,
updatedMethods
,
updatedTrackingSpans
,
diagnostics
);
ReportSyntacticRudeEdits
(
diagnostics
,
script
.
Match
,
edit
,
editMap
);
}
UpdateUneditedSpans
(
diagnostics
,
script
.
Match
,
oldText
,
newText
,
documentId
,
trackingService
,
oldActiveStatements
,
newActiveStatements
,
newExceptionRegions
,
updatedTrackingSpans
);
UpdateUneditedSpans
(
diagnostics
,
script
.
Match
,
oldText
,
newText
,
documentId
,
trackingService
,
oldActiveStatements
,
editedActiveStatements
,
newActiveStatements
,
newExceptionRegions
,
updatedTrackingSpans
);
if
(
updatedTrackingSpans
.
Count
>
0
)
{
...
...
@@ -579,6 +580,7 @@ private SyntaxNode FindStatement(SyntaxNode declarationBody, int position, out i
DocumentId
documentId
,
IActiveStatementTrackingService
trackingService
,
ImmutableArray
<
ActiveStatementSpan
>
oldActiveStatements
,
BitVector
editedActiveStatements
,
[
In
,
Out
]
LinePositionSpan
[]
newActiveStatements
,
[
In
,
Out
]
ImmutableArray
<
LinePositionSpan
>[]
newExceptionRegions
,
[
In
,
Out
]
List
<
KeyValuePair
<
ActiveStatementId
,
TextSpan
>>
updatedTrackingSpans
)
...
...
@@ -591,7 +593,7 @@ private SyntaxNode FindStatement(SyntaxNode declarationBody, int position, out i
for
(
int
i
=
0
;
i
<
newActiveStatements
.
Length
;
i
++)
{
if
(
newActiveStatements
[
i
]
==
default
(
LinePositionSpan
)
)
if
(
!
editedActiveStatements
[
i
]
)
{
Debug
.
Assert
(
newExceptionRegions
[
i
].
IsDefault
);
...
...
@@ -840,6 +842,7 @@ internal struct UpdatedMemberInfo
DocumentId
documentId
,
IActiveStatementTrackingService
trackingService
,
ImmutableArray
<
ActiveStatementSpan
>
oldActiveStatements
,
ref
BitVector
editedActiveStatements
,
[
Out
]
LinePositionSpan
[]
newActiveStatements
,
[
Out
]
ImmutableArray
<
LinePositionSpan
>[]
newExceptionRegions
,
[
Out
]
List
<
UpdatedMemberInfo
>
updatedMembers
,
...
...
@@ -886,8 +889,8 @@ internal struct UpdatedMemberInfo
// TODO: VB field multi-initializers break this
// Debug.Assert(newActiveStatements[i] == default(LinePositionSpan));
Debug
.
Assert
(
newSpan
!=
default
(
TextSpan
));
newActiveStatements
[
i
]
=
newText
.
Lines
.
GetLinePositionSpan
(
newSpan
);
editedActiveStatements
[
i
]
=
true
;
newExceptionRegions
[
i
]
=
ImmutableArray
.
Create
<
LinePositionSpan
>();
}
}
...
...
@@ -906,6 +909,7 @@ internal struct UpdatedMemberInfo
{
Debug
.
Assert
(
newActiveStatements
[
i
]
==
default
(
LinePositionSpan
)
&&
newSpan
!=
default
(
TextSpan
));
newActiveStatements
[
i
]
=
newText
.
Lines
.
GetLinePositionSpan
(
newSpan
);
editedActiveStatements
[
i
]
=
true
;
newExceptionRegions
[
i
]
=
ImmutableArray
.
Create
<
LinePositionSpan
>();
}
}
...
...
@@ -1084,6 +1088,7 @@ internal struct UpdatedMemberInfo
Debug
.
Assert
(
newActiveStatements
[
ordinal
]
==
default
(
LinePositionSpan
)
&&
newSpan
!=
default
(
TextSpan
));
newActiveStatements
[
ordinal
]
=
newText
.
Lines
.
GetLinePositionSpan
(
newSpan
);
editedActiveStatements
[
ordinal
]
=
true
;
// Update tracking span if we found a matching active statement whose span is different.
// It could have been deleted or moved out of the method/lambda body, in which case we set it to empty.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录