Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
823e3fe3
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,发现更多精彩内容 >>
提交
823e3fe3
编写于
4月 30, 2020
作者:
C
Cyrus Najmabadi
提交者:
Sam Harwell
5月 14, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Wrap embedded statements over multiple lines.
上级
65d799af
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
336 addition
and
151 deletion
+336
-151
src/Analyzers/Core/Analyzers/UseCompoundAssignment/UseCompoundAssignmentUtilities.cs
...s/UseCompoundAssignment/UseCompoundAssignmentUtilities.cs
+2
-1
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/TypeImportCompletionProviderTests.cs
.../CompletionProviders/TypeImportCompletionProviderTests.cs
+2
-1
src/EditorFeatures/Core.Wpf/Interactive/CSharpVBResetCommand.cs
...itorFeatures/Core.Wpf/Interactive/CSharpVBResetCommand.cs
+2
-1
src/EditorFeatures/Core/Implementation/CodeFixes/CodeFixService.cs
...rFeatures/Core/Implementation/CodeFixes/CodeFixService.cs
+2
-1
src/EditorFeatures/Core/Implementation/EditorLayerExtensionManager.cs
...atures/Core/Implementation/EditorLayerExtensionManager.cs
+11
-2
src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
...ies/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
+2
-1
src/EditorFeatures/Test/EditAndContinue/DebuggeeModuleMetadataCacheTests.cs
.../Test/EditAndContinue/DebuggeeModuleMetadataCacheTests.cs
+5
-1
src/EditorFeatures/Test/Threading/ForegroundNotificationServiceTests.cs
...ures/Test/Threading/ForegroundNotificationServiceTests.cs
+5
-1
src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/SyntaxHelpers.cs
...aluator/CSharp/Source/ExpressionCompiler/SyntaxHelpers.cs
+2
-1
src/ExpressionEvaluator/Core/Source/ResultProvider/Formatter.Values.cs
...nEvaluator/Core/Source/ResultProvider/Formatter.Values.cs
+4
-2
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeHelpers.cs
...aluator/Core/Source/ResultProvider/Helpers/TypeHelpers.cs
+2
-1
src/ExpressionEvaluator/Core/Test/ResultProvider/ResultProviderTestBase.cs
...luator/Core/Test/ResultProvider/ResultProviderTestBase.cs
+4
-2
src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs
...le/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs
+4
-1
src/Features/CSharp/Portable/Debugging/CSharpProximityExpressionsService.RelevantExpressionsCollector.cs
...oximityExpressionsService.RelevantExpressionsCollector.cs
+6
-3
src/Features/Core/Portable/CodeRefactorings/AddAwait/AbstractAddAwaitCodeRefactoringProvider.cs
...rings/AddAwait/AbstractAddAwaitCodeRefactoringProvider.cs
+2
-1
src/Features/Core/Portable/Completion/Providers/AbstractDocCommentCompletionProvider.cs
...pletion/Providers/AbstractDocCommentCompletionProvider.cs
+2
-1
src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionProvider.cs
...ompletionProvider/AbstractTypeImportCompletionProvider.cs
+2
-1
src/Scripting/CSharp/CSharpScript.cs
src/Scripting/CSharp/CSharpScript.cs
+8
-4
src/Scripting/CSharpTest.Desktop/InteractiveSessionReferencesTests.cs
...g/CSharpTest.Desktop/InteractiveSessionReferencesTests.cs
+4
-2
src/Scripting/CSharpTest/ObjectFormatterTests.cs
src/Scripting/CSharpTest/ObjectFormatterTests.cs
+6
-1
src/Scripting/Core/Script.cs
src/Scripting/Core/Script.cs
+2
-1
src/Scripting/CoreTestUtilities/ObjectFormatterFixtures/Custom.cs
...pting/CoreTestUtilities/ObjectFormatterFixtures/Custom.cs
+5
-1
src/Test/PdbUtilities/Reader/PdbValidation.cs
src/Test/PdbUtilities/Reader/PdbValidation.cs
+2
-1
src/Test/PdbUtilities/Reader/Token2SourceLineExporter.cs
src/Test/PdbUtilities/Reader/Token2SourceLineExporter.cs
+14
-7
src/Test/Utilities/Portable/Assert/AssertEx.cs
src/Test/Utilities/Portable/Assert/AssertEx.cs
+6
-3
src/Test/Utilities/Portable/FX/ProcessUtilities.cs
src/Test/Utilities/Portable/FX/ProcessUtilities.cs
+2
-1
src/Test/Utilities/Portable/InstrumentationChecker.cs
src/Test/Utilities/Portable/InstrumentationChecker.cs
+4
-1
src/Test/Utilities/Portable/Metadata/IlasmUtilities.cs
src/Test/Utilities/Portable/Metadata/IlasmUtilities.cs
+2
-1
src/Test/Utilities/Portable/Metadata/MetadataReaderUtils.cs
src/Test/Utilities/Portable/Metadata/MetadataReaderUtils.cs
+5
-1
src/Test/Utilities/Portable/Metadata/MetadataSignatureUnitTestHelper.cs
...ties/Portable/Metadata/MetadataSignatureUnitTestHelper.cs
+4
-2
src/Test/Utilities/Portable/Mocks/TestStream.cs
src/Test/Utilities/Portable/Mocks/TestStream.cs
+2
-1
src/Test/Utilities/Portable/Platform/Custom/MetadataSignatureHelper.cs
...ities/Portable/Platform/Custom/MetadataSignatureHelper.cs
+155
-78
src/Test/Utilities/Portable/TempFiles/TempRoot.cs
src/Test/Utilities/Portable/TempFiles/TempRoot.cs
+3
-1
src/Test/Utilities/Portable/Win32Res.cs
src/Test/Utilities/Portable/Win32Res.cs
+4
-2
src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator/BoundNodeClassWriter.cs
...orTools/Source/BoundTreeGenerator/BoundNodeClassWriter.cs
+6
-3
src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs
...neratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs
+2
-1
src/Tools/Source/CompilerGeneratorTools/Source/IOperationGenerator/IOperationClassWriter.Verifier.cs
...rce/IOperationGenerator/IOperationClassWriter.Verifier.cs
+4
-2
src/Tools/Source/CompilerGeneratorTools/Source/IOperationGenerator/IOperationClassWriter.cs
...Tools/Source/IOperationGenerator/IOperationClassWriter.cs
+20
-10
src/VisualStudio/CSharp/Test/Interactive/Commands/InteractiveCommandHandlerTests.cs
...st/Interactive/Commands/InteractiveCommandHandlerTests.cs
+4
-1
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpFindReferences.cs
...ationTest/IntegrationTests/CSharp/CSharpFindReferences.cs
+2
-1
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/TextViewWindow_InProc.cs
...tionTest/TestUtilities/InProcess/TextViewWindow_InProc.cs
+4
-1
src/Workspaces/Core/Portable/CodeCleanup/AbstractCodeCleanerService.cs
...s/Core/Portable/CodeCleanup/AbstractCodeCleanerService.cs
+2
-1
src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs
src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs
+5
-1
未找到文件。
src/Analyzers/Core/Analyzers/UseCompoundAssignment/UseCompoundAssignmentUtilities.cs
浏览文件 @
823e3fe3
...
...
@@ -19,7 +19,8 @@ internal static class UseCompoundAssignmentUtilities
out
ImmutableDictionary
<
TSyntaxKind
,
TSyntaxKind
>
assignmentToTokenMap
)
{
var
binaryToAssignmentBuilder
=
ImmutableDictionary
.
CreateBuilder
<
TSyntaxKind
,
TSyntaxKind
>();
var
assignmentToTokenBuilder
=
ImmutableDictionary
.
CreateBuilder
<
TSyntaxKind
,
TSyntaxKind
>();
;
var
assignmentToTokenBuilder
=
ImmutableDictionary
.
CreateBuilder
<
TSyntaxKind
,
TSyntaxKind
>();
;
foreach
(
var
(
exprKind
,
assignmentKind
,
tokenKind
)
in
kinds
)
{
...
...
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/TypeImportCompletionProviderTests.cs
浏览文件 @
823e3fe3
...
...
@@ -774,7 +774,8 @@ class Bat
{
$$
}
}"
;
var
expectedCodeAfterCommit
=
@"
}"
;
var
expectedCodeAfterCommit
=
@"
using Foo.Bar;
namespace Baz
...
...
src/EditorFeatures/Core.Wpf/Interactive/CSharpVBResetCommand.cs
浏览文件 @
823e3fe3
...
...
@@ -96,7 +96,8 @@ internal static IEnumerable<int> GetNoConfigPositions(string arguments)
while
(
true
)
{
var
index
=
arguments
.
IndexOf
(
NoConfigParameterName
,
startIndex
,
StringComparison
.
Ordinal
);
if
(
index
<
0
)
yield
break
;
if
(
index
<
0
)
yield
break
;
if
((
index
==
0
||
char
.
IsWhiteSpace
(
arguments
[
index
-
1
]))
&&
(
index
+
s_noConfigParameterNameLength
==
arguments
.
Length
||
char
.
IsWhiteSpace
(
arguments
[
index
+
s_noConfigParameterNameLength
])))
...
...
src/EditorFeatures/Core/Implementation/CodeFixes/CodeFixService.cs
浏览文件 @
823e3fe3
...
...
@@ -349,7 +349,8 @@ public async Task<Document> ApplyCodeFixesForSpecificDiagnosticIdAsync(Document
cancellationToken
:
cancellationToken
).
ConfigureAwait
(
false
);
// Just need the first result if we are doing fix all in span
if
(
fixAllForInSpan
&&
result
.
Any
())
return
;
if
(
fixAllForInSpan
&&
result
.
Any
())
return
;
}
}
finally
...
...
src/EditorFeatures/Core/Implementation/EditorLayerExtensionManager.cs
浏览文件 @
823e3fe3
...
...
@@ -74,8 +74,17 @@ public override void HandleException(object provider, Exception exception)
_errorReportingService
?.
ShowErrorInfoInActiveView
(
String
.
Format
(
WorkspacesResources
.
_0_encountered_an_error_and_has_been_disabled
,
provider
.
GetType
().
Name
),
new
InfoBarUI
(
WorkspacesResources
.
Show_Stack_Trace
,
InfoBarUI
.
UIKind
.
HyperLink
,
()
=>
ShowDetailedErrorInfo
(
exception
),
closeAfterAction
:
false
),
new
InfoBarUI
(
WorkspacesResources
.
Enable
,
InfoBarUI
.
UIKind
.
Button
,
()
=>
{
EnableProvider
(
provider
);
LogEnableProvider
(
provider
);
}),
new
InfoBarUI
(
WorkspacesResources
.
Enable_and_ignore_future_errors
,
InfoBarUI
.
UIKind
.
Button
,
()
=>
{
EnableProvider
(
provider
);
IgnoreProvider
(
provider
);
LogEnableAndIgnoreProvider
(
provider
);
}),
new
InfoBarUI
(
WorkspacesResources
.
Enable
,
InfoBarUI
.
UIKind
.
Button
,
()
=>
{
EnableProvider
(
provider
);
LogEnableProvider
(
provider
);
}),
new
InfoBarUI
(
WorkspacesResources
.
Enable_and_ignore_future_errors
,
InfoBarUI
.
UIKind
.
Button
,
()
=>
{
EnableProvider
(
provider
);
IgnoreProvider
(
provider
);
LogEnableAndIgnoreProvider
(
provider
);
}),
new
InfoBarUI
(
String
.
Empty
,
InfoBarUI
.
UIKind
.
Close
,
()
=>
LogLeaveDisabled
(
provider
)));
}
else
...
...
src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest.cs
浏览文件 @
823e3fe3
...
...
@@ -431,7 +431,8 @@ protected Task TestSmartTagGlyphTagsAsync(string initialMarkup, ImmutableArray<s
foreach
(
var
diagnostic
in
diagnosticsWithTag
)
{
var
documentOffset
=
initialMarkupWithoutSpans
.
IndexOf
(
diagnosticsWithTag
.
First
().
Location
.
SourceTree
.
ToString
());
if
(
documentOffset
==
-
1
)
continue
;
if
(
documentOffset
==
-
1
)
continue
;
segments
.
Add
((
documentOffset
+
diagnostic
.
Location
.
SourceSpan
.
Start
,
"{|"
+
markupKey
+
":"
));
segments
.
Add
((
documentOffset
+
diagnostic
.
Location
.
SourceSpan
.
End
,
"|}"
));
...
...
src/EditorFeatures/Test/EditAndContinue/DebuggeeModuleMetadataCacheTests.cs
浏览文件 @
823e3fe3
...
...
@@ -16,7 +16,11 @@ public void GetOrAddNull()
var
cache
=
new
DebuggeeModuleInfoCache
();
var
mvid
=
Guid
.
NewGuid
();
Assert
.
Null
(
cache
.
GetOrAdd
(
mvid
,
m
=>
{
Assert
.
Equal
(
mvid
,
m
);
return
null
;
}));
Assert
.
Null
(
cache
.
GetOrAdd
(
mvid
,
m
=>
{
Assert
.
Equal
(
mvid
,
m
);
return
null
;
}));
}
[
Fact
]
...
...
src/EditorFeatures/Test/Threading/ForegroundNotificationServiceTests.cs
浏览文件 @
823e3fe3
...
...
@@ -42,7 +42,11 @@ public async Task Test_Enqueue()
Service
.
RegisterNotification
(()
=>
{
Thread
.
Sleep
(
100
);
},
asyncToken
,
CancellationToken
.
None
);
Service
.
RegisterNotification
(()
=>
{
/* do nothing */
},
asyncToken
,
CancellationToken
.
None
);
Service
.
RegisterNotification
(()
=>
{
ran
=
true
;
_done
=
true
;
},
asyncToken
,
CancellationToken
.
None
);
Service
.
RegisterNotification
(()
=>
{
ran
=
true
;
_done
=
true
;
},
asyncToken
,
CancellationToken
.
None
);
await
PumpWait
();
...
...
src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/SyntaxHelpers.cs
浏览文件 @
823e3fe3
...
...
@@ -209,7 +209,8 @@ private static InternalSyntax.ExpressionSyntax ParseDebuggerExpressionInternal(S
using
var
parser
=
new
InternalSyntax
.
LanguageParser
(
lexer
,
oldTree
:
null
,
changes
:
null
,
lexerMode
:
InternalSyntax
.
LexerMode
.
DebuggerSyntax
);
var
node
=
parser
.
ParseExpression
();
if
(
consumeFullText
)
node
=
parser
.
ConsumeUnexpectedTokens
(
node
);
if
(
consumeFullText
)
node
=
parser
.
ConsumeUnexpectedTokens
(
node
);
return
node
;
}
...
...
src/ExpressionEvaluator/Core/Source/ResultProvider/Formatter.Values.cs
浏览文件 @
823e3fe3
...
...
@@ -315,7 +315,8 @@ protected static void FillUsedEnumFields(ArrayBuilder<EnumField> usedFields, Arr
foreach
(
var
field
in
fields
)
{
var
fieldValue
=
field
.
Value
;
if
(
fieldValue
==
0
)
continue
;
// Otherwise, we'd tack the zero flag onto everything.
if
(
fieldValue
==
0
)
continue
;
// Otherwise, we'd tack the zero flag onto everything.
if
((
remaining
&
fieldValue
)
==
fieldValue
)
{
...
...
@@ -323,7 +324,8 @@ protected static void FillUsedEnumFields(ArrayBuilder<EnumField> usedFields, Arr
usedFields
.
Add
(
field
);
if
(
remaining
==
0
)
break
;
if
(
remaining
==
0
)
break
;
}
}
...
...
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/TypeHelpers.cs
浏览文件 @
823e3fe3
...
...
@@ -840,7 +840,8 @@ internal static MemberInfo GetOriginalDefinition(this MemberInfo member)
foreach
(
var
candidate
in
declaringTypeOriginalDefinition
.
GetMember
(
member
.
Name
,
MemberBindingFlags
))
{
var
memberType
=
candidate
.
MemberType
;
if
(
memberType
!=
member
.
MemberType
)
continue
;
if
(
memberType
!=
member
.
MemberType
)
continue
;
switch
(
memberType
)
{
...
...
src/ExpressionEvaluator/Core/Test/ResultProvider/ResultProviderTestBase.cs
浏览文件 @
823e3fe3
...
...
@@ -367,9 +367,11 @@ internal static void Verify(IReadOnlyList<DkmEvaluationResult> actual, params Dk
private
static
string
ToString
(
DkmEvaluationResult
result
)
{
if
(
result
is
DkmSuccessEvaluationResult
success
)
return
ToString
(
success
);
if
(
result
is
DkmSuccessEvaluationResult
success
)
return
ToString
(
success
);
if
(
result
is
DkmIntermediateEvaluationResult
intermediate
)
return
ToString
(
intermediate
);
if
(
result
is
DkmIntermediateEvaluationResult
intermediate
)
return
ToString
(
intermediate
);
return
ToString
((
DkmFailedEvaluationResult
)
result
);
}
...
...
src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs
浏览文件 @
823e3fe3
...
...
@@ -254,7 +254,10 @@ private bool CanTryConvertToLocalFunction()
SyntaxNode
currentNode
=
_source
;
while
(
currentNode
!=
null
)
{
if
(
currentNode
is
StatementSyntax
)
{
return
true
;
}
if
(
currentNode
is
StatementSyntax
)
{
return
true
;
}
if
(
currentNode
is
ExpressionSyntax
||
currentNode
is
ArgumentSyntax
||
currentNode
is
ArgumentListSyntax
||
...
...
src/Features/CSharp/Portable/Debugging/CSharpProximityExpressionsService.RelevantExpressionsCollector.cs
浏览文件 @
823e3fe3
...
...
@@ -110,7 +110,8 @@ public override void VisitSwitchStatement(SwitchStatementSyntax node)
ExpressionSyntax
component
,
IList
<
string
>
expressions
)
{
if
(!
_includeDeclarations
)
return
;
if
(!
_includeDeclarations
)
return
;
switch
(
component
.
Kind
())
{
...
...
@@ -137,14 +138,16 @@ public override void VisitSwitchStatement(SwitchStatementSyntax node)
VariableDesignationSyntax
component
,
IList
<
string
>
expressions
)
{
if
(!
_includeDeclarations
)
return
;
if
(!
_includeDeclarations
)
return
;
switch
(
component
.
Kind
())
{
case
SyntaxKind
.
ParenthesizedVariableDesignation
:
{
var
t
=
(
ParenthesizedVariableDesignationSyntax
)
component
;
foreach
(
var
v
in
t
.
Variables
)
AddVariableExpressions
(
v
,
expressions
);
foreach
(
var
v
in
t
.
Variables
)
AddVariableExpressions
(
v
,
expressions
);
break
;
}
case
SyntaxKind
.
SingleVariableDesignation
:
...
...
src/Features/Core/Portable/CodeRefactorings/AddAwait/AbstractAddAwaitCodeRefactoringProvider.cs
浏览文件 @
823e3fe3
...
...
@@ -100,7 +100,8 @@ private bool IsValidAwaitableExpression(SyntaxNode invocation, SemanticModel mod
.
AddParentheses
(
syntaxGenerator
.
AwaitExpression
(
withoutTrivia
))
.
WithTriviaFrom
(
invocation
);
return
await
document
.
ReplaceNodeAsync
(
invocation
,
awaitExpression
,
cancellationToken
).
ConfigureAwait
(
false
);
;
return
await
document
.
ReplaceNodeAsync
(
invocation
,
awaitExpression
,
cancellationToken
).
ConfigureAwait
(
false
);
;
}
private
class
MyCodeAction
:
CodeAction
.
DocumentChangeAction
...
...
src/Features/Core/Portable/Completion/Providers/AbstractDocCommentCompletionProvider.cs
浏览文件 @
823e3fe3
...
...
@@ -67,7 +67,8 @@ internal abstract class AbstractDocCommentCompletionProvider<TSyntax> : LSPCompl
protected
AbstractDocCommentCompletionProvider
(
CompletionItemRules
defaultRules
)
{
this
.
defaultRules
=
defaultRules
??
throw
new
ArgumentNullException
(
nameof
(
defaultRules
));
;
this
.
defaultRules
=
defaultRules
??
throw
new
ArgumentNullException
(
nameof
(
defaultRules
));
;
}
public
override
async
Task
ProvideCompletionsAsync
(
CompletionContext
context
)
...
...
src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionProvider.cs
浏览文件 @
823e3fe3
...
...
@@ -67,7 +67,8 @@ private static void AddItems(ImmutableArray<CompletionItem> items, CompletionCon
// the provider can not be used as a service by components that might be run in parallel
// with completion, which would be a race.
completionContext
.
AddItem
(
item
);
counter
.
ItemsCount
++;
;
counter
.
ItemsCount
++;
;
}
}
}
...
...
src/Scripting/CSharp/CSharpScript.cs
浏览文件 @
823e3fe3
...
...
@@ -29,7 +29,8 @@ public static class CSharpScript
/// <exception cref="ArgumentNullException">Code is null.</exception>
public
static
Script
<
T
>
Create
<
T
>(
string
code
,
ScriptOptions
options
=
null
,
Type
globalsType
=
null
,
InteractiveAssemblyLoader
assemblyLoader
=
null
)
{
if
(
code
==
null
)
throw
new
ArgumentNullException
(
nameof
(
code
));
if
(
code
==
null
)
throw
new
ArgumentNullException
(
nameof
(
code
));
return
Script
.
CreateInitialScript
<
T
>(
CSharpScriptCompiler
.
Instance
,
SourceText
.
From
(
code
,
options
?.
FileEncoding
),
options
,
globalsType
,
assemblyLoader
);
}
...
...
@@ -45,7 +46,8 @@ public static Script<T> Create<T>(string code, ScriptOptions options = null, Typ
/// <exception cref="ArgumentException">Stream is not readable or seekable.</exception>
public
static
Script
<
T
>
Create
<
T
>(
Stream
code
,
ScriptOptions
options
=
null
,
Type
globalsType
=
null
,
InteractiveAssemblyLoader
assemblyLoader
=
null
)
{
if
(
code
==
null
)
throw
new
ArgumentNullException
(
nameof
(
code
));
if
(
code
==
null
)
throw
new
ArgumentNullException
(
nameof
(
code
));
return
Script
.
CreateInitialScript
<
T
>(
CSharpScriptCompiler
.
Instance
,
SourceText
.
From
(
code
,
options
?.
FileEncoding
),
options
,
globalsType
,
assemblyLoader
);
}
...
...
@@ -59,7 +61,8 @@ public static Script<T> Create<T>(Stream code, ScriptOptions options = null, Typ
/// <exception cref="ArgumentNullException">Code is null.</exception>
public
static
Script
<
object
>
Create
(
string
code
,
ScriptOptions
options
=
null
,
Type
globalsType
=
null
,
InteractiveAssemblyLoader
assemblyLoader
=
null
)
{
if
(
code
==
null
)
throw
new
ArgumentNullException
(
nameof
(
code
));
if
(
code
==
null
)
throw
new
ArgumentNullException
(
nameof
(
code
));
return
Create
<
object
>(
code
,
options
,
globalsType
,
assemblyLoader
);
}
...
...
@@ -74,7 +77,8 @@ public static Script<object> Create(string code, ScriptOptions options = null, T
/// <exception cref="ArgumentException">Stream is not readable or seekable.</exception>
public
static
Script
<
object
>
Create
(
Stream
code
,
ScriptOptions
options
=
null
,
Type
globalsType
=
null
,
InteractiveAssemblyLoader
assemblyLoader
=
null
)
{
if
(
code
==
null
)
throw
new
ArgumentNullException
(
nameof
(
code
));
if
(
code
==
null
)
throw
new
ArgumentNullException
(
nameof
(
code
));
return
Create
<
object
>(
code
,
options
,
globalsType
,
assemblyLoader
);
}
...
...
src/Scripting/CSharpTest.Desktop/InteractiveSessionReferencesTests.cs
浏览文件 @
823e3fe3
...
...
@@ -244,7 +244,8 @@ public void References2()
[
Fact
]
public
void
References_Versioning_FxUnification1
()
{
if
(!
s_isSystemV2AndV4Available
.
Value
)
return
;
if
(!
s_isSystemV2AndV4Available
.
Value
)
return
;
var
script
=
CSharpScript
.
Create
(
$@"
#r ""System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089""
...
...
@@ -273,7 +274,8 @@ public void References_Versioning_FxUnification1()
[
Fact
]
public
void
References_Versioning_FxUnification2
()
{
if
(!
s_isSystemV2AndV4Available
.
Value
)
return
;
if
(!
s_isSystemV2AndV4Available
.
Value
)
return
;
var
script0
=
CSharpScript
.
Create
(
$@"
#r ""System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089""
...
...
src/Scripting/CSharpTest/ObjectFormatterTests.cs
浏览文件 @
823e3fe3
...
...
@@ -460,7 +460,12 @@ public void DebuggerProxy_FrameworkTypes_IEnumerable_Exception()
string
str
;
object
obj
;
obj
=
Enumerable
.
Range
(
0
,
10
).
Where
(
i
=>
{
if
(
i
==
5
)
throw
new
Exception
(
"xxx"
);
return
i
<
7
;
});
obj
=
Enumerable
.
Range
(
0
,
10
).
Where
(
i
=>
{
if
(
i
==
5
)
throw
new
Exception
(
"xxx"
);
return
i
<
7
;
});
str
=
s_formatter
.
FormatObject
(
obj
,
SingleLineOptions
);
Assert
.
Equal
(
"Enumerable.WhereEnumerableIterator<int> { 0, 1, 2, 3, 4, !<Exception> ... }"
,
str
);
}
...
...
src/Scripting/Core/Script.cs
浏览文件 @
823e3fe3
...
...
@@ -121,7 +121,8 @@ public Script<TResult> ContinueWith<TResult>(string code, ScriptOptions options
/// <exception cref="ArgumentException">Stream is not readable or seekable.</exception>
public
Script
<
TResult
>
ContinueWith
<
TResult
>(
Stream
code
,
ScriptOptions
options
=
null
)
{
if
(
code
==
null
)
throw
new
ArgumentNullException
(
nameof
(
code
));
if
(
code
==
null
)
throw
new
ArgumentNullException
(
nameof
(
code
));
options
=
options
??
InheritOptions
(
Options
);
return
new
Script
<
TResult
>(
Compiler
,
Builder
,
SourceText
.
From
(
code
,
options
.
FileEncoding
),
options
,
GlobalsType
,
this
);
}
...
...
src/Scripting/CoreTestUtilities/ObjectFormatterFixtures/Custom.cs
浏览文件 @
823e3fe3
...
...
@@ -73,7 +73,11 @@ internal class RecursiveProxy
private
class
Proxy
{
public
Proxy
()
{
}
public
Proxy
(
Node
node
)
{
x
=
node
.
value
;
y
=
node
.
next
;
}
public
Proxy
(
Node
node
)
{
x
=
node
.
value
;
y
=
node
.
next
;
}
public
readonly
int
x
;
public
readonly
Node
y
;
...
...
src/Test/PdbUtilities/Reader/PdbValidation.cs
浏览文件 @
823e3fe3
...
...
@@ -421,7 +421,8 @@ private static void RemoveEmptyScopes(XElement pdb)
{
while
(
RemoveElements
(
from
e
in
pdb
.
DescendantsAndSelf
()
where
e
.
Name
==
"scope"
&&
!
e
.
HasElements
select
e
))
;
select
e
))
;
}
private
static
void
RemoveEmptySequencePoints
(
XElement
pdb
)
...
...
src/Test/PdbUtilities/Reader/Token2SourceLineExporter.cs
浏览文件 @
823e3fe3
...
...
@@ -322,7 +322,8 @@ internal BitSet(BitAccess bits)
internal
bool
IsSet
(
int
index
)
{
int
word
=
index
/
32
;
if
(
word
>=
_size
)
return
false
;
if
(
word
>=
_size
)
return
false
;
return
((
_words
[
word
]
&
GetBit
(
index
))
!=
0
);
}
...
...
@@ -1148,13 +1149,17 @@ public static string TokenToSourceMap2Xml(Stream read, bool maskToken = false)
(
x
,
y
)
=>
{
int
result
=
x
.
line
.
CompareTo
(
y
.
line
);
if
(
result
!=
0
)
return
result
;
if
(
result
!=
0
)
return
result
;
result
=
x
.
column
.
CompareTo
(
y
.
column
);
if
(
result
!=
0
)
return
result
;
if
(
result
!=
0
)
return
result
;
result
=
x
.
endLine
.
CompareTo
(
y
.
endLine
);
if
(
result
!=
0
)
return
result
;
if
(
result
!=
0
)
return
result
;
result
=
x
.
endColumn
.
CompareTo
(
y
.
endColumn
);
if
(
result
!=
0
)
return
result
;
if
(
result
!=
0
)
return
result
;
return
x
.
token
.
CompareTo
(
y
.
token
);
});
...
...
@@ -1181,7 +1186,8 @@ public static string TokenToSourceMap2Xml(Stream read, bool maskToken = false)
private
static
string
Token2String
(
uint
token
,
bool
maskToken
)
{
string
result
=
token
.
ToString
(
"X8"
);
if
(
maskToken
)
result
=
result
.
Substring
(
0
,
2
)
+
"xxxxxx"
;
if
(
maskToken
)
result
=
result
.
Substring
(
0
,
2
)
+
"xxxxxx"
;
return
"0x"
+
result
;
}
...
...
@@ -1325,7 +1331,8 @@ private static string Token2String(uint token, bool maskToken)
tokenToSourceMapping
.
Add
(
token
,
new
PdbTokenLine
(
token
,
file_id
,
line
,
column
,
endLine
,
endColumn
));
else
{
while
(
tokenLine
.
nextLine
!=
null
)
tokenLine
=
tokenLine
.
nextLine
;
while
(
tokenLine
.
nextLine
!=
null
)
tokenLine
=
tokenLine
.
nextLine
;
tokenLine
.
nextLine
=
new
PdbTokenLine
(
token
,
file_id
,
line
,
column
,
endLine
,
endColumn
);
}
}
...
...
src/Test/Utilities/Portable/Assert/AssertEx.cs
浏览文件 @
823e3fe3
...
...
@@ -380,15 +380,18 @@ int levenshtein(string first, string second)
// the length of the other, since that number of insertions
// would be required.
int
n
=
first
.
Length
,
m
=
second
.
Length
;
if
(
n
==
0
)
return
m
;
if
(
m
==
0
)
return
n
;
if
(
n
==
0
)
return
m
;
if
(
m
==
0
)
return
n
;
// Rather than maintain an entire matrix (which would require O(n*m) space),
// just store the current row and the next row, each of which has a length m+1,
// so just O(m) space. Initialize the current row.
int
curRow
=
0
,
nextRow
=
1
;
int
[][]
rows
=
new
int
[][]
{
new
int
[
m
+
1
],
new
int
[
m
+
1
]
};
for
(
int
j
=
0
;
j
<=
m
;
++
j
)
rows
[
curRow
][
j
]
=
j
;
for
(
int
j
=
0
;
j
<=
m
;
++
j
)
rows
[
curRow
][
j
]
=
j
;
// For each virtual row (since we only have physical storage for two)
for
(
int
i
=
1
;
i
<=
n
;
++
i
)
...
...
src/Test/Utilities/Portable/FX/ProcessUtilities.cs
浏览文件 @
823e3fe3
...
...
@@ -23,7 +23,8 @@ public static class ProcessUtilities
string
stdInput
=
null
,
bool
redirectStandardInput
=
false
)
{
if
(
fileName
==
null
)
throw
new
ArgumentNullException
(
nameof
(
fileName
));
if
(
fileName
==
null
)
throw
new
ArgumentNullException
(
nameof
(
fileName
));
var
startInfo
=
new
ProcessStartInfo
{
...
...
src/Test/Utilities/Portable/InstrumentationChecker.cs
浏览文件 @
823e3fe3
...
...
@@ -348,7 +348,10 @@ internal static ImmutableArray<string> GetActualSnippets(int method, DynamicAnal
return
actualSpans
.
SelectAsArray
((
span
,
lines
)
=>
{
if
(
span
.
StartLine
>=
lines
.
Length
)
{
return
null
;
}
if
(
span
.
StartLine
>=
lines
.
Length
)
{
return
null
;
}
return
lines
[
span
.
StartLine
].
Substring
(
span
.
StartColumn
).
TrimEnd
(
new
[]
{
'\r'
,
'\n'
,
' '
});
},
sourceLines
);
}
...
...
src/Test/Utilities/Portable/Metadata/IlasmUtilities.cs
浏览文件 @
823e3fe3
...
...
@@ -58,7 +58,8 @@ private static string GetIlasmPath()
public
static
void
IlasmTempAssembly
(
string
declarations
,
bool
appendDefaultHeader
,
bool
includePdb
,
bool
autoInherit
,
out
string
assemblyPath
,
out
string
pdbPath
)
{
if
(
declarations
==
null
)
throw
new
ArgumentNullException
(
nameof
(
declarations
));
if
(
declarations
==
null
)
throw
new
ArgumentNullException
(
nameof
(
declarations
));
using
(
var
sourceFile
=
new
DisposableFile
(
extension
:
".il"
))
{
...
...
src/Test/Utilities/Portable/Metadata/MetadataReaderUtils.cs
浏览文件 @
823e3fe3
...
...
@@ -120,7 +120,11 @@ public static StringHandle[] GetTypeDefNames(this MetadataReader reader)
public
static
(
StringHandle
Namespace
,
StringHandle
Name
)[]
GetTypeDefFullNames
(
this
MetadataReader
reader
)
{
return
reader
.
TypeDefinitions
.
Select
(
handle
=>
{
var
td
=
reader
.
GetTypeDefinition
(
handle
);
return
(
td
.
Namespace
,
td
.
Name
);
}).
ToArray
();
return
reader
.
TypeDefinitions
.
Select
(
handle
=>
{
var
td
=
reader
.
GetTypeDefinition
(
handle
);
return
(
td
.
Namespace
,
td
.
Name
);
}).
ToArray
();
}
public
static
StringHandle
[]
GetTypeRefNames
(
this
MetadataReader
reader
)
...
...
src/Test/Utilities/Portable/Metadata/MetadataSignatureUnitTestHelper.cs
浏览文件 @
823e3fe3
...
...
@@ -76,7 +76,8 @@ internal class MetadataSignatureUnitTestHelper
Assert
.
False
(
string
.
IsNullOrWhiteSpace
(
fullyQualifiedTypeName
),
"'fullyQualifiedTypeName' can't be null or empty"
);
Assert
.
False
(
string
.
IsNullOrWhiteSpace
(
memberName
),
"'memberName' can't be null or empty"
);
var
retVal
=
true
;
actualSignatures
=
new
List
<
string
>();
var
retVal
=
true
;
actualSignatures
=
new
List
<
string
>();
var
signatures
=
appDomainHost
.
GetMemberSignaturesFromMetadata
(
fullyQualifiedTypeName
,
memberName
);
var
signatureAssertText
=
"Signature(\""
+
fullyQualifiedTypeName
+
"\", \""
+
memberName
+
"\", \"{0}\"),"
;
...
...
@@ -98,7 +99,8 @@ internal class MetadataSignatureUnitTestHelper
{
actualSignatures
.
Clear
();
actualSignatures
.
Add
(
actualSignature
);
found
=
true
;
break
;
found
=
true
;
break
;
}
else
{
...
...
src/Test/Utilities/Portable/Mocks/TestStream.cs
浏览文件 @
823e3fe3
...
...
@@ -51,7 +51,8 @@ public override long Position
{
get
{
if
(!
CanSeek
)
throw
new
NotSupportedException
();
if
(!
CanSeek
)
throw
new
NotSupportedException
();
if
(
_getPosition
!=
null
)
{
return
_getPosition
();
...
...
src/Test/Utilities/Portable/Platform/Custom/MetadataSignatureHelper.cs
浏览文件 @
823e3fe3
...
...
@@ -36,9 +36,12 @@ static private void AppendType(Type type, StringBuilder sb, bool showGenericCons
if
(
showGenericConstraints
&&
type
.
IsGenericParameter
)
{
var
typeInfo
=
type
.
GetTypeInfo
();
if
(
typeInfo
.
GenericParameterAttributes
.
HasFlag
(
GenericParameterAttributes
.
ReferenceTypeConstraint
))
sb
.
Append
(
"class "
);
if
(
typeInfo
.
GenericParameterAttributes
.
HasFlag
(
GenericParameterAttributes
.
NotNullableValueTypeConstraint
))
sb
.
Append
(
"valuetype "
);
if
(
typeInfo
.
GenericParameterAttributes
.
HasFlag
(
GenericParameterAttributes
.
DefaultConstructorConstraint
))
sb
.
Append
(
".ctor "
);
if
(
typeInfo
.
GenericParameterAttributes
.
HasFlag
(
GenericParameterAttributes
.
ReferenceTypeConstraint
))
sb
.
Append
(
"class "
);
if
(
typeInfo
.
GenericParameterAttributes
.
HasFlag
(
GenericParameterAttributes
.
NotNullableValueTypeConstraint
))
sb
.
Append
(
"valuetype "
);
if
(
typeInfo
.
GenericParameterAttributes
.
HasFlag
(
GenericParameterAttributes
.
DefaultConstructorConstraint
))
sb
.
Append
(
".ctor "
);
var
genericConstraints
=
typeInfo
.
GetGenericParameterConstraints
();
if
(
genericConstraints
.
Length
>
0
)
...
...
@@ -149,14 +152,19 @@ public static bool AppendParameterAttributes(StringBuilder sb, ParameterAttribut
{
List
<
string
>
list
=
new
List
<
string
>();
if
((
attributes
&
ParameterAttributes
.
Optional
)
!=
0
)
list
.
Add
(
"[opt]"
);
if
((
attributes
&
ParameterAttributes
.
In
)
!=
0
)
list
.
Add
(
"[in]"
);
if
((
attributes
&
ParameterAttributes
.
Out
)
!=
0
)
list
.
Add
(
"[out]"
);
if
((
attributes
&
ParameterAttributes
.
Optional
)
!=
0
)
list
.
Add
(
"[opt]"
);
if
((
attributes
&
ParameterAttributes
.
In
)
!=
0
)
list
.
Add
(
"[in]"
);
if
((
attributes
&
ParameterAttributes
.
Out
)
!=
0
)
list
.
Add
(
"[out]"
);
if
(
all
)
{
if
((
attributes
&
ParameterAttributes
.
HasFieldMarshal
)
!=
0
)
list
.
Add
(
"marshal"
);
if
((
attributes
&
ParameterAttributes
.
HasDefault
)
!=
0
)
list
.
Add
(
"default"
);
if
((
attributes
&
ParameterAttributes
.
HasFieldMarshal
)
!=
0
)
list
.
Add
(
"marshal"
);
if
((
attributes
&
ParameterAttributes
.
HasDefault
)
!=
0
)
list
.
Add
(
"default"
);
}
sb
.
Append
(
list
.
Join
(
" "
));
...
...
@@ -167,12 +175,15 @@ public static bool AppendPropertyAttributes(StringBuilder sb, PropertyAttributes
{
List
<
string
>
list
=
new
List
<
string
>();
if
((
attributes
&
PropertyAttributes
.
SpecialName
)
!=
0
)
list
.
Add
(
"specialname"
);
if
((
attributes
&
PropertyAttributes
.
RTSpecialName
)
!=
0
)
list
.
Add
(
"rtspecialname"
);
if
((
attributes
&
PropertyAttributes
.
SpecialName
)
!=
0
)
list
.
Add
(
"specialname"
);
if
((
attributes
&
PropertyAttributes
.
RTSpecialName
)
!=
0
)
list
.
Add
(
"rtspecialname"
);
if
(
all
)
{
if
((
attributes
&
PropertyAttributes
.
HasDefault
)
!=
0
)
list
.
Add
(
"default"
);
if
((
attributes
&
PropertyAttributes
.
HasDefault
)
!=
0
)
list
.
Add
(
"default"
);
}
sb
.
Append
(
list
.
Join
(
" "
));
...
...
@@ -183,8 +194,10 @@ public static bool AppendEventAttributes(StringBuilder sb, EventAttributes attri
{
List
<
string
>
list
=
new
List
<
string
>();
if
((
attributes
&
EventAttributes
.
SpecialName
)
!=
0
)
list
.
Add
(
"specialname"
);
if
((
attributes
&
EventAttributes
.
RTSpecialName
)
!=
0
)
list
.
Add
(
"rtspecialname"
);
if
((
attributes
&
EventAttributes
.
SpecialName
)
!=
0
)
list
.
Add
(
"specialname"
);
if
((
attributes
&
EventAttributes
.
RTSpecialName
)
!=
0
)
list
.
Add
(
"rtspecialname"
);
sb
.
Append
(
list
.
Join
(
" "
));
return
list
.
Count
>
0
;
...
...
@@ -210,18 +223,27 @@ public static StringBuilder AppendFieldAttributes(StringBuilder sb, FieldAttribu
sb
.
Append
(
visibility
);
sb
.
Append
((
attributes
&
FieldAttributes
.
Static
)
!=
0
?
" static"
:
" instance"
);
if
((
attributes
&
FieldAttributes
.
InitOnly
)
!=
0
)
sb
.
Append
(
" initonly"
);
if
((
attributes
&
FieldAttributes
.
Literal
)
!=
0
)
sb
.
Append
(
" literal"
);
if
((
attributes
&
FieldAttributes
.
NotSerialized
)
!=
0
)
sb
.
Append
(
" notserialized"
);
if
((
attributes
&
FieldAttributes
.
SpecialName
)
!=
0
)
sb
.
Append
(
" specialname"
);
if
((
attributes
&
FieldAttributes
.
RTSpecialName
)
!=
0
)
sb
.
Append
(
" rtspecialname"
);
if
((
attributes
&
FieldAttributes
.
InitOnly
)
!=
0
)
sb
.
Append
(
" initonly"
);
if
((
attributes
&
FieldAttributes
.
Literal
)
!=
0
)
sb
.
Append
(
" literal"
);
if
((
attributes
&
FieldAttributes
.
NotSerialized
)
!=
0
)
sb
.
Append
(
" notserialized"
);
if
((
attributes
&
FieldAttributes
.
SpecialName
)
!=
0
)
sb
.
Append
(
" specialname"
);
if
((
attributes
&
FieldAttributes
.
RTSpecialName
)
!=
0
)
sb
.
Append
(
" rtspecialname"
);
if
(
all
)
{
if
((
attributes
&
FieldAttributes
.
PinvokeImpl
)
!=
0
)
sb
.
Append
(
" pinvokeimpl"
);
if
((
attributes
&
FieldAttributes
.
HasFieldMarshal
)
!=
0
)
sb
.
Append
(
" marshal"
);
if
((
attributes
&
FieldAttributes
.
HasDefault
)
!=
0
)
sb
.
Append
(
" default"
);
if
((
attributes
&
FieldAttributes
.
HasFieldRVA
)
!=
0
)
sb
.
Append
(
" rva"
);
if
((
attributes
&
FieldAttributes
.
PinvokeImpl
)
!=
0
)
sb
.
Append
(
" pinvokeimpl"
);
if
((
attributes
&
FieldAttributes
.
HasFieldMarshal
)
!=
0
)
sb
.
Append
(
" marshal"
);
if
((
attributes
&
FieldAttributes
.
HasDefault
)
!=
0
)
sb
.
Append
(
" default"
);
if
((
attributes
&
FieldAttributes
.
HasFieldRVA
)
!=
0
)
sb
.
Append
(
" rva"
);
}
return
sb
;
...
...
@@ -246,22 +268,33 @@ public static StringBuilder AppendMethodAttributes(StringBuilder sb, MethodAttri
sb
.
Append
(
visibility
);
if
((
attributes
&
MethodAttributes
.
HideBySig
)
!=
0
)
sb
.
Append
(
" hidebysig"
);
if
((
attributes
&
MethodAttributes
.
NewSlot
)
!=
0
)
sb
.
Append
(
" newslot"
);
if
((
attributes
&
MethodAttributes
.
CheckAccessOnOverride
)
!=
0
)
sb
.
Append
(
" strict"
);
if
((
attributes
&
MethodAttributes
.
SpecialName
)
!=
0
)
sb
.
Append
(
" specialname"
);
if
((
attributes
&
MethodAttributes
.
RTSpecialName
)
!=
0
)
sb
.
Append
(
" rtspecialname"
);
if
((
attributes
&
MethodAttributes
.
RequireSecObject
)
!=
0
)
sb
.
Append
(
" reqsecobj"
);
if
((
attributes
&
MethodAttributes
.
UnmanagedExport
)
!=
0
)
sb
.
Append
(
" unmanagedexp"
);
if
((
attributes
&
MethodAttributes
.
Abstract
)
!=
0
)
sb
.
Append
(
" abstract"
);
if
((
attributes
&
MethodAttributes
.
Virtual
)
!=
0
)
sb
.
Append
(
" virtual"
);
if
((
attributes
&
MethodAttributes
.
Final
)
!=
0
)
sb
.
Append
(
" final"
);
if
((
attributes
&
MethodAttributes
.
HideBySig
)
!=
0
)
sb
.
Append
(
" hidebysig"
);
if
((
attributes
&
MethodAttributes
.
NewSlot
)
!=
0
)
sb
.
Append
(
" newslot"
);
if
((
attributes
&
MethodAttributes
.
CheckAccessOnOverride
)
!=
0
)
sb
.
Append
(
" strict"
);
if
((
attributes
&
MethodAttributes
.
SpecialName
)
!=
0
)
sb
.
Append
(
" specialname"
);
if
((
attributes
&
MethodAttributes
.
RTSpecialName
)
!=
0
)
sb
.
Append
(
" rtspecialname"
);
if
((
attributes
&
MethodAttributes
.
RequireSecObject
)
!=
0
)
sb
.
Append
(
" reqsecobj"
);
if
((
attributes
&
MethodAttributes
.
UnmanagedExport
)
!=
0
)
sb
.
Append
(
" unmanagedexp"
);
if
((
attributes
&
MethodAttributes
.
Abstract
)
!=
0
)
sb
.
Append
(
" abstract"
);
if
((
attributes
&
MethodAttributes
.
Virtual
)
!=
0
)
sb
.
Append
(
" virtual"
);
if
((
attributes
&
MethodAttributes
.
Final
)
!=
0
)
sb
.
Append
(
" final"
);
sb
.
Append
((
attributes
&
MethodAttributes
.
Static
)
!=
0
?
" static"
:
" instance"
);
if
(
all
)
{
if
((
attributes
&
MethodAttributes
.
PinvokeImpl
)
!=
0
)
sb
.
Append
(
" pinvokeimpl"
);
if
((
attributes
&
MethodAttributes
.
PinvokeImpl
)
!=
0
)
sb
.
Append
(
" pinvokeimpl"
);
}
return
sb
;
...
...
@@ -285,13 +318,20 @@ public static StringBuilder AppendMethodImplAttributes(StringBuilder sb, MethodI
sb
.
Append
(
" "
);
sb
.
Append
((
attributes
&
MethodImplAttributes
.
Unmanaged
)
==
MethodImplAttributes
.
Unmanaged
?
"unmanaged"
:
"managed"
);
if
((
attributes
&
MethodImplAttributes
.
PreserveSig
)
!=
0
)
sb
.
Append
(
" preservesig"
);
if
((
attributes
&
MethodImplAttributes
.
ForwardRef
)
!=
0
)
sb
.
Append
(
" forwardref"
);
if
((
attributes
&
MethodImplAttributes
.
InternalCall
)
!=
0
)
sb
.
Append
(
" internalcall"
);
if
((
attributes
&
MethodImplAttributes
.
Synchronized
)
!=
0
)
sb
.
Append
(
" synchronized"
);
if
((
attributes
&
MethodImplAttributes
.
NoInlining
)
!=
0
)
sb
.
Append
(
" noinlining"
);
if
((
attributes
&
MethodImplAttributes
.
AggressiveInlining
)
!=
0
)
sb
.
Append
(
" aggressiveinlining"
);
if
((
attributes
&
MethodImplAttributes
.
NoOptimization
)
!=
0
)
sb
.
Append
(
" nooptimization"
);
if
((
attributes
&
MethodImplAttributes
.
PreserveSig
)
!=
0
)
sb
.
Append
(
" preservesig"
);
if
((
attributes
&
MethodImplAttributes
.
ForwardRef
)
!=
0
)
sb
.
Append
(
" forwardref"
);
if
((
attributes
&
MethodImplAttributes
.
InternalCall
)
!=
0
)
sb
.
Append
(
" internalcall"
);
if
((
attributes
&
MethodImplAttributes
.
Synchronized
)
!=
0
)
sb
.
Append
(
" synchronized"
);
if
((
attributes
&
MethodImplAttributes
.
NoInlining
)
!=
0
)
sb
.
Append
(
" noinlining"
);
if
((
attributes
&
MethodImplAttributes
.
AggressiveInlining
)
!=
0
)
sb
.
Append
(
" aggressiveinlining"
);
if
((
attributes
&
MethodImplAttributes
.
NoOptimization
)
!=
0
)
sb
.
Append
(
" nooptimization"
);
return
sb
;
}
...
...
@@ -336,24 +376,33 @@ public static StringBuilder AppendTypeAttributes(StringBuilder sb, TypeAttribute
throw
new
InvalidOperationException
();
}
if
((
attributes
&
TypeAttributes
.
Interface
)
!=
0
)
sb
.
Append
(
"interface "
);
if
((
attributes
&
TypeAttributes
.
Interface
)
!=
0
)
sb
.
Append
(
"interface "
);
sb
.
Append
(
visibility
);
if
((
attributes
&
TypeAttributes
.
Abstract
)
!=
0
)
sb
.
Append
(
" abstract"
);
if
((
attributes
&
TypeAttributes
.
Abstract
)
!=
0
)
sb
.
Append
(
" abstract"
);
sb
.
Append
(
" "
);
sb
.
Append
(
layout
);
sb
.
Append
(
" "
);
sb
.
Append
(
stringFormat
);
if
((
attributes
&
TypeAttributes
.
Import
)
!=
0
)
sb
.
Append
(
" import"
);
if
((
attributes
&
TypeAttributes
.
WindowsRuntime
)
!=
0
)
sb
.
Append
(
" windowsruntime"
);
if
((
attributes
&
TypeAttributes
.
Sealed
)
!=
0
)
sb
.
Append
(
" sealed"
);
if
((
attributes
&
TypeAttributes
.
Serializable
)
!=
0
)
sb
.
Append
(
" serializable"
);
if
((
attributes
&
TypeAttributes
.
BeforeFieldInit
)
!=
0
)
sb
.
Append
(
" beforefieldinit"
);
if
((
attributes
&
TypeAttributes
.
SpecialName
)
!=
0
)
sb
.
Append
(
" specialname"
);
if
((
attributes
&
TypeAttributes
.
RTSpecialName
)
!=
0
)
sb
.
Append
(
" rtspecialname"
);
if
((
attributes
&
TypeAttributes
.
Import
)
!=
0
)
sb
.
Append
(
" import"
);
if
((
attributes
&
TypeAttributes
.
WindowsRuntime
)
!=
0
)
sb
.
Append
(
" windowsruntime"
);
if
((
attributes
&
TypeAttributes
.
Sealed
)
!=
0
)
sb
.
Append
(
" sealed"
);
if
((
attributes
&
TypeAttributes
.
Serializable
)
!=
0
)
sb
.
Append
(
" serializable"
);
if
((
attributes
&
TypeAttributes
.
BeforeFieldInit
)
!=
0
)
sb
.
Append
(
" beforefieldinit"
);
if
((
attributes
&
TypeAttributes
.
SpecialName
)
!=
0
)
sb
.
Append
(
" specialname"
);
if
((
attributes
&
TypeAttributes
.
RTSpecialName
)
!=
0
)
sb
.
Append
(
" rtspecialname"
);
return
sb
;
}
...
...
@@ -436,18 +485,30 @@ static private void AppendConstructorInfo(ConstructorInfo constructor, StringBui
sb
.
Append
(
")"
);
var
implFlags
=
constructor
.
GetMethodImplementationFlags
();
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
IL
))
sb
.
Append
(
" cil"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
ForwardRef
))
sb
.
Append
(
" forwardref"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
InternalCall
))
sb
.
Append
(
" internalcall"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
Managed
))
sb
.
Append
(
" managed"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
Native
))
sb
.
Append
(
" native"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
NoInlining
))
sb
.
Append
(
" noinlining"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
NoOptimization
))
sb
.
Append
(
" nooptimization"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
OPTIL
))
sb
.
Append
(
" optil"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
PreserveSig
))
sb
.
Append
(
" preservesig"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
Runtime
))
sb
.
Append
(
" runtime"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
Synchronized
))
sb
.
Append
(
" synchronized"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
Unmanaged
))
sb
.
Append
(
" unmanaged"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
IL
))
sb
.
Append
(
" cil"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
ForwardRef
))
sb
.
Append
(
" forwardref"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
InternalCall
))
sb
.
Append
(
" internalcall"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
Managed
))
sb
.
Append
(
" managed"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
Native
))
sb
.
Append
(
" native"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
NoInlining
))
sb
.
Append
(
" noinlining"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
NoOptimization
))
sb
.
Append
(
" nooptimization"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
OPTIL
))
sb
.
Append
(
" optil"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
PreserveSig
))
sb
.
Append
(
" preservesig"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
Runtime
))
sb
.
Append
(
" runtime"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
Synchronized
))
sb
.
Append
(
" synchronized"
);
if
(
implFlags
.
HasFlag
(
MethodImplAttributes
.
Unmanaged
))
sb
.
Append
(
" unmanaged"
);
}
static
private
void
AppendPropertyInfo
(
PropertyInfo
property
,
StringBuilder
sb
)
...
...
@@ -485,8 +546,10 @@ static private void AppendPropertyInfo(PropertyInfo property, StringBuilder sb)
sb
.
Append
(
"writeonly "
);
}
if
(
property
.
Attributes
.
HasFlag
(
PropertyAttributes
.
SpecialName
))
sb
.
Append
(
"specialname "
);
if
(
property
.
Attributes
.
HasFlag
(
PropertyAttributes
.
RTSpecialName
))
sb
.
Append
(
"rtspecialname "
);
if
(
property
.
Attributes
.
HasFlag
(
PropertyAttributes
.
SpecialName
))
sb
.
Append
(
"specialname "
);
if
(
property
.
Attributes
.
HasFlag
(
PropertyAttributes
.
RTSpecialName
))
sb
.
Append
(
"rtspecialname "
);
var
propertyAccessors
=
property
.
GetAccessors
();
if
(
propertyAccessors
.
Length
>
0
)
...
...
@@ -534,19 +597,31 @@ static private void AppendFieldInfo(FieldInfo field, StringBuilder sb)
sb
.
Append
(
") "
);
}
if
(
field
.
IsPrivate
)
sb
.
Append
(
"private "
);
if
(
field
.
IsPublic
)
sb
.
Append
(
"public "
);
if
(
field
.
IsFamily
)
sb
.
Append
(
"family "
);
if
(
field
.
IsAssembly
)
sb
.
Append
(
"assembly "
);
if
(
field
.
IsFamilyOrAssembly
)
sb
.
Append
(
"famorassem "
);
if
(
field
.
IsFamilyAndAssembly
)
sb
.
Append
(
"famandassem "
);
if
(
field
.
IsInitOnly
)
sb
.
Append
(
"initonly "
);
if
(
field
.
IsLiteral
)
sb
.
Append
(
"literal "
);
if
(
field
.
IsNotSerialized
)
sb
.
Append
(
"notserialized "
);
if
(
field
.
Attributes
.
HasFlag
(
FieldAttributes
.
SpecialName
))
sb
.
Append
(
"specialname "
);
if
(
field
.
Attributes
.
HasFlag
(
FieldAttributes
.
RTSpecialName
))
sb
.
Append
(
"rtspecialname "
);
if
(
field
.
IsPinvokeImpl
)
sb
.
Append
(
"pinvokeimpl "
);
if
(
field
.
IsPrivate
)
sb
.
Append
(
"private "
);
if
(
field
.
IsPublic
)
sb
.
Append
(
"public "
);
if
(
field
.
IsFamily
)
sb
.
Append
(
"family "
);
if
(
field
.
IsAssembly
)
sb
.
Append
(
"assembly "
);
if
(
field
.
IsFamilyOrAssembly
)
sb
.
Append
(
"famorassem "
);
if
(
field
.
IsFamilyAndAssembly
)
sb
.
Append
(
"famandassem "
);
if
(
field
.
IsInitOnly
)
sb
.
Append
(
"initonly "
);
if
(
field
.
IsLiteral
)
sb
.
Append
(
"literal "
);
if
(
field
.
IsNotSerialized
)
sb
.
Append
(
"notserialized "
);
if
(
field
.
Attributes
.
HasFlag
(
FieldAttributes
.
SpecialName
))
sb
.
Append
(
"specialname "
);
if
(
field
.
Attributes
.
HasFlag
(
FieldAttributes
.
RTSpecialName
))
sb
.
Append
(
"rtspecialname "
);
if
(
field
.
IsPinvokeImpl
)
sb
.
Append
(
"pinvokeimpl "
);
sb
.
Append
(
field
.
IsStatic
?
"static "
:
"instance "
);
AppendType
(
field
.
FieldType
,
sb
);
...
...
@@ -569,8 +644,10 @@ static private void AppendEventInfo(EventInfo @event, StringBuilder sb)
sb
.
Append
(
" "
);
}
if
(
@event
.
Attributes
.
HasFlag
(
EventAttributes
.
SpecialName
))
sb
.
Append
(
"specialname "
);
if
(
@event
.
Attributes
.
HasFlag
(
EventAttributes
.
RTSpecialName
))
sb
.
Append
(
"rtspecialname "
);
if
(
@event
.
Attributes
.
HasFlag
(
EventAttributes
.
SpecialName
))
sb
.
Append
(
"specialname "
);
if
(
@event
.
Attributes
.
HasFlag
(
EventAttributes
.
RTSpecialName
))
sb
.
Append
(
"rtspecialname "
);
AppendType
(
@event
.
EventHandlerType
,
sb
);
sb
.
Append
(
" "
);
...
...
src/Test/Utilities/Portable/TempFiles/TempRoot.cs
浏览文件 @
823e3fe3
...
...
@@ -71,7 +71,9 @@ public DisposableFile AddFile(DisposableFile file)
internal
static
void
CreateStream
(
string
fullPath
,
FileMode
mode
)
{
using
(
var
file
=
new
FileStream
(
fullPath
,
mode
))
{
}
using
(
var
file
=
new
FileStream
(
fullPath
,
mode
))
{
}
}
}
}
src/Test/Utilities/Portable/Win32Res.cs
浏览文件 @
823e3fe3
...
...
@@ -254,12 +254,14 @@ public static string VersionResourceToXml(IntPtr versionRsrc)
int
keyLength
=
length
-
(
valueLength
*
2
)
-
(
3
*
sizeof
(
short
));
char
[]
key
=
new
char
[
keyLength
/
sizeof
(
char
)];
for
(
int
i
=
0
;
i
<
key
.
Length
;
i
++)
key
[
i
]
=
reader
.
ReadChar
();
for
(
int
i
=
0
;
i
<
key
.
Length
;
i
++)
key
[
i
]
=
reader
.
ReadChar
();
reader
.
BaseStream
.
Position
=
(
reader
.
BaseStream
.
Position
+
3
)
&
~
3
;
char
[]
value
=
new
char
[
valueLength
];
for
(
int
i
=
0
;
i
<
value
.
Length
;
i
++)
value
[
i
]
=
reader
.
ReadChar
();
for
(
int
i
=
0
;
i
<
value
.
Length
;
i
++)
value
[
i
]
=
reader
.
ReadChar
();
System
.
Diagnostics
.
Debug
.
Assert
(
length
==
(
reader
.
BaseStream
.
Position
-
startPos
));
return
new
Tuple
<
string
,
string
>(
new
string
(
key
),
new
string
(
value
));
...
...
src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator/BoundNodeClassWriter.cs
浏览文件 @
823e3fe3
...
...
@@ -1440,7 +1440,8 @@ private void WriteNullabilityRewriter()
foreach
(
var
node
in
_tree
.
Types
.
OfType
<
Node
>())
{
if
(
SkipInNullabilityRewriter
(
node
))
continue
;
if
(
SkipInNullabilityRewriter
(
node
))
continue
;
var
allSpecifiableFields
=
AllSpecifiableFields
(
node
).
ToList
();
var
isExpression
=
IsDerivedType
(
"BoundExpression"
,
node
.
Name
);
...
...
@@ -1560,9 +1561,11 @@ void writeNullabilityUpdate()
static
bool
symbolIsPotentiallyUpdated
(
Field
f
)
{
if
(!
TypeIsSymbol
(
f
))
return
false
;
if
(!
TypeIsSymbol
(
f
))
return
false
;
if
(
f
.
Name
==
"Type"
)
return
false
;
if
(
f
.
Name
==
"Type"
)
return
false
;
return
typeIsUpdated
(
f
.
Type
);
}
...
...
src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs
浏览文件 @
823e3fe3
...
...
@@ -958,7 +958,8 @@ private void WriteRedType(TreeType node)
WriteLine
(
"get"
);
OpenBlock
();
WriteLine
(
$"var slot = ((Syntax.InternalSyntax.
{
node
.
Name
}
)this.Green).
{
CamelCase
(
field
.
Name
)}
;"
);
WriteLine
(
$"return slot != null ? new SyntaxToken(this, slot,
{
GetChildPosition
(
i
)}
,
{
GetChildIndex
(
i
)}
) : default;"
);
CloseBlock
();
WriteLine
(
$"return slot != null ? new SyntaxToken(this, slot,
{
GetChildPosition
(
i
)}
,
{
GetChildIndex
(
i
)}
) : default;"
);
CloseBlock
();
CloseBlock
();
}
else
...
...
src/Tools/Source/CompilerGeneratorTools/Source/IOperationGenerator/IOperationClassWriter.Verifier.cs
浏览文件 @
823e3fe3
...
...
@@ -51,8 +51,10 @@ private bool ModelHasErrors(Tree tree)
}
}
if
(!(
abstractNode
is
Node
node
))
continue
;
if
(
node
.
SkipChildrenGeneration
||
node
.
SkipClassGeneration
)
continue
;
if
(!(
abstractNode
is
Node
node
))
continue
;
if
(
node
.
SkipChildrenGeneration
||
node
.
SkipClassGeneration
)
continue
;
var
properties
=
GetAllGeneratedIOperationProperties
(
node
).
Where
(
p
=>
!
p
.
IsInternal
).
Select
(
p
=>
p
.
Name
).
ToList
();
...
...
src/Tools/Source/CompilerGeneratorTools/Source/IOperationGenerator/IOperationClassWriter.cs
浏览文件 @
823e3fe3
...
...
@@ -220,7 +220,8 @@ private void WriteComments(Comments? comments, bool writeReservedRemark)
foreach
(
var
line
in
lines
)
{
if
(
string
.
IsNullOrWhiteSpace
(
line
))
continue
;
if
(
string
.
IsNullOrWhiteSpace
(
line
))
continue
;
WriteLine
(
$"///
{
line
.
Substring
(
indentation
)}
"
);
}
...
...
@@ -250,7 +251,8 @@ void writeReservedRemarkText()
private
void
WriteInterfaceProperty
(
Property
prop
)
{
if
(
prop
.
IsInternal
)
return
;
if
(
prop
.
IsInternal
)
return
;
WriteComments
(
prop
.
Comments
,
writeReservedRemark
:
false
);
var
modifiers
=
prop
.
IsNew
?
"new "
:
""
;
WriteLine
(
$"
{
modifiers
}{
prop
.
Type
}
{
prop
.
Name
}
{{
get
;
}}
"
);
...
...
@@ -349,7 +351,8 @@ private void WriteClasses()
WriteLine
(
"#region Implementations"
);
foreach
(
var
type
in
_tree
.
Types
.
OfType
<
AbstractNode
>())
{
if
(
type
.
SkipClassGeneration
)
continue
;
if
(
type
.
SkipClassGeneration
)
continue
;
var
allProps
=
GetAllProperties
(
type
);
bool
hasSkippedProperties
=
!
GetAllProperties
(
type
,
includeSkipGenerationProperties
:
true
).
SequenceEqual
(
allProps
);
...
...
@@ -382,7 +385,8 @@ private void WriteClasses()
foreach
(
var
prop
in
type
.
Properties
)
{
if
(
prop
.
SkipGeneration
)
continue
;
if
(
prop
.
SkipGeneration
)
continue
;
writeProperty
(
prop
,
propExtensibility
:
IsIOperationType
(
prop
.
Type
)
?
"abstract "
:
string
.
Empty
);
}
...
...
@@ -450,7 +454,8 @@ void writeIfCheck(string memberName)
Unbrace
();
}
if
(
type
.
IsAbstract
)
continue
;
if
(
type
.
IsAbstract
)
continue
;
// Generate the non-lazy class. Nested block to allow for duplicate variable names
{
...
...
@@ -482,7 +487,8 @@ void writeIfCheck(string memberName)
{
foreach
(
var
property
in
type
.
Properties
)
{
if
(
property
.
SkipGeneration
)
continue
;
if
(
property
.
SkipGeneration
)
continue
;
writeProperty
(
property
,
propExtensibility
:
string
.
Empty
);
}
...
...
@@ -567,7 +573,8 @@ void writeConstructor(string accessibility, string @class, IEnumerable<Property>
Write
(
$"
{
accessibility
}
{
@class
}
("
);
foreach
(
var
prop
in
properties
)
{
if
(
classType
!=
ClassType
.
NonLazy
&&
IsIOperationType
(
prop
.
Type
))
continue
;
if
(
classType
!=
ClassType
.
NonLazy
&&
IsIOperationType
(
prop
.
Type
))
continue
;
if
(
prop
.
Type
==
"CommonConversion"
)
{
Write
(
$"IConvertibleConversion
{
prop
.
Name
.
ToCamelCase
()}
, "
);
...
...
@@ -716,7 +723,8 @@ private void WriteVisitors()
var
types
=
_tree
.
Types
.
OfType
<
Node
>();
foreach
(
var
type
in
types
)
{
if
(
type
.
SkipInVisitor
)
continue
;
if
(
type
.
SkipInVisitor
)
continue
;
WriteObsoleteIfNecessary
(
type
.
Obsolete
);
var
accessibility
=
type
.
IsInternal
?
"internal"
:
"public"
;
...
...
@@ -735,7 +743,8 @@ private void WriteVisitors()
foreach
(
var
type
in
types
)
{
if
(
type
.
SkipInVisitor
)
continue
;
if
(
type
.
SkipInVisitor
)
continue
;
WriteObsoleteIfNecessary
(
type
.
Obsolete
);
var
accessibility
=
type
.
IsInternal
?
"internal"
:
"public"
;
...
...
@@ -768,7 +777,8 @@ private List<Property> GetAllProperties(AbstractNode node, bool includeSkipGener
{
string
baseName
=
@base
.
Base
;
@base
=
_typeMap
[
baseName
];
if
(
@base
is
null
)
break
;
if
(
@base
is
null
)
break
;
properties
.
AddRange
(
@base
.
Properties
.
Where
(
p
=>
!
p
.
SkipGeneration
||
includeSkipGenerationProperties
));
}
...
...
src/VisualStudio/CSharp/Test/Interactive/Commands/InteractiveCommandHandlerTests.cs
浏览文件 @
823e3fe3
...
...
@@ -201,7 +201,10 @@ private static void AssertExecuteInInteractive(ExportProvider exportProvider, st
private
static
void
AssertExecuteInInteractive
(
ExportProvider
exportProvider
,
string
code
,
string
[]
expectedSubmissions
,
string
submissionBuffer
=
null
)
{
var
submissions
=
new
List
<
string
>();
void
appendSubmission
(
object
_
,
string
item
)
{
submissions
.
Add
(
item
.
TrimEnd
());
}
void
appendSubmission
(
object
_
,
string
item
)
{
submissions
.
Add
(
item
.
TrimEnd
());
}
using
var
workspace
=
InteractiveWindowCommandHandlerTestState
.
CreateTestState
(
exportProvider
,
code
);
PrepareSubmissionBuffer
(
submissionBuffer
,
workspace
);
...
...
src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpFindReferences.cs
浏览文件 @
823e3fe3
...
...
@@ -33,7 +33,8 @@ class Program
{
}$$
"
);
var
project
=
new
ProjectUtils
.
Project
(
ProjectName
);
;
var
project
=
new
ProjectUtils
.
Project
(
ProjectName
);
;
VisualStudio
.
SolutionExplorer
.
AddFile
(
project
,
"File2.cs"
);
VisualStudio
.
SolutionExplorer
.
OpenFile
(
project
,
"File2.cs"
);
...
...
src/VisualStudio/IntegrationTest/TestUtilities/InProcess/TextViewWindow_InProc.cs
浏览文件 @
823e3fe3
...
...
@@ -268,7 +268,10 @@ public void VerifyTags(string tagTypeName, int expectedCount)
=>
ExecuteOnActiveView
(
view
=>
{
Type
type
=
WellKnownTagNames
.
GetTagTypeByName
(
tagTypeName
);
bool
filterTag
(
IMappingTagSpan
<
ITag
>
tag
)
{
return
tag
.
Tag
.
GetType
().
Equals
(
type
);
}
bool
filterTag
(
IMappingTagSpan
<
ITag
>
tag
)
{
return
tag
.
Tag
.
GetType
().
Equals
(
type
);
}
var
service
=
GetComponentModelService
<
IViewTagAggregatorFactoryService
>();
var
aggregator
=
service
.
CreateTagAggregator
<
ITag
>(
view
);
var
allTags
=
aggregator
.
GetTags
(
new
SnapshotSpan
(
view
.
TextSnapshot
,
0
,
view
.
TextSnapshot
.
Length
));
...
...
src/Workspaces/Core/Portable/CodeCleanup/AbstractCodeCleanerService.cs
浏览文件 @
823e3fe3
...
...
@@ -485,7 +485,8 @@ private bool CleanupWholeNode(TextSpan nodeSpan, ImmutableArray<TextSpan> spans)
// Document was changed by the previous code cleaner, compute new spans.
var
root
=
await
currentDocument
.
GetSyntaxRootAsync
(
cancellationToken
).
ConfigureAwait
(
false
);
previousDocument
=
currentDocument
;
spans
=
GetSpans
(
root
,
spanGetter
);
;
spans
=
GetSpans
(
root
,
spanGetter
);
;
}
// If we are at the end and there were no changes to the document, use the original document for the cleanup.
...
...
src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs
浏览文件 @
823e3fe3
...
...
@@ -184,7 +184,11 @@ private static void GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellat
var
cancellationTokenSource
=
new
CancellationTokenSource
();
// Create a task that will cancel the request once it's started
Task
.
Run
(()
=>
{
computeFunctionRunning
.
WaitOne
();
cancellationTokenSource
.
Cancel
();
});
Task
.
Run
(()
=>
{
computeFunctionRunning
.
WaitOne
();
cancellationTokenSource
.
Cancel
();
});
try
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录