Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
c5e64fe0
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,发现更多精彩内容 >>
提交
c5e64fe0
编写于
5月 17, 2017
作者:
G
Gen Lu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Address review comments
上级
cfd402ce
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
9 addition
and
19 deletion
+9
-19
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
+2
-7
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs
...arp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs
+5
-10
src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs
...arp/Test/Semantic/IOperation/IOperationTests_IArgument.cs
+1
-1
src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs
src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs
+1
-1
未找到文件。
src/Compilers/CSharp/Portable/BoundTree/Expression.cs
浏览文件 @
c5e64fe0
...
...
@@ -119,16 +119,11 @@ internal static IArgument CreateArgumentOperation(ArgumentKind kind, IParameterS
//TODO: https://github.com/dotnet/roslyn/issues/18722
// Right now, for erroneous code, we exposes all expression in place of arguments as IArgument with Parameter set to null,
// so user needs to check IsInvalid first before using anything we returned. Need to implement a new interface for invalid invocation instead.
if
(
n
.
HasErrors
||
optionalParametersMethod
==
null
)
if
(
n
.
HasErrors
||
(
object
)
optionalParametersMethod
==
null
)
{
// optionalParametersMethod can be null if we are writing to a readonly indexer or reading from an writeonly indexer,
// in which case HasErrors property would be true, but we still want to treat this as invalid invocation.
ArrayBuilder
<
IArgument
>
argumentsWithErrors
=
ArrayBuilder
<
IArgument
>.
GetInstance
(
boundArguments
.
Length
);
for
(
int
a
=
0
;
a
<
boundArguments
.
Length
;
++
a
)
{
argumentsWithErrors
.
Add
(
CreateArgumentOperation
(
ArgumentKind
.
Explicit
,
null
,
boundArguments
[
a
]));
}
return
argumentsWithErrors
.
ToImmutableAndFree
();
return
boundArguments
.
SelectAsArray
(
arg
=>
CreateArgumentOperation
(
ArgumentKind
.
Explicit
,
null
,
arg
));
}
return
LocalRewriter
.
MakeArgumentsInEvaluationOrder
(
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs
浏览文件 @
c5e64fe0
...
...
@@ -391,7 +391,7 @@ private static bool IsSafeForReordering(BoundExpression expression, RefKind kind
ArrayBuilder
<
LocalSymbol
>
temporariesBuilder
=
ArrayBuilder
<
LocalSymbol
>.
GetInstance
();
rewrittenArguments
=
_factory
.
MakeTempsForDiscardArguments
(
rewrittenArguments
,
temporariesBuilder
);
if
(
CanSkipRewriting
(
re
f
re
writtenArguments
,
methodOrIndexer
,
expanded
,
argsToParamsOpt
,
invokedAsExtensionMethod
,
out
var
isComReceiver
))
if
(
CanSkipRewriting
(
rewrittenArguments
,
methodOrIndexer
,
expanded
,
argsToParamsOpt
,
invokedAsExtensionMethod
,
out
var
isComReceiver
))
{
temps
=
temporariesBuilder
.
ToImmutableAndFree
();
return
rewrittenArguments
;
...
...
@@ -519,9 +519,7 @@ private static bool IsSafeForReordering(BoundExpression expression, RefKind kind
ArrayBuilder
<
IArgument
>
argumentsInEvaluationBuilder
=
ArrayBuilder
<
IArgument
>.
GetInstance
(
parameters
.
Length
);
bool
canSkipRewriting
=
CanSkipRewriting
(
ref
arguments
,
methodOrIndexer
,
expanded
,
argsToParamsOpt
,
invokedAsExtensionMethod
,
out
var
isComReceiver
);
if
(
canSkipRewriting
)
if
(
CanSkipRewriting
(
arguments
,
methodOrIndexer
,
expanded
,
argsToParamsOpt
,
invokedAsExtensionMethod
,
out
var
isComReceiver
))
{
// In this case, the invocation is not in expanded form and there's no named argument provided.
// So we just return list of arguments as is.
...
...
@@ -529,7 +527,7 @@ private static bool IsSafeForReordering(BoundExpression expression, RefKind kind
{
argumentsInEvaluationBuilder
.
Add
(
BoundCall
.
CreateArgumentOperation
(
ArgumentKind
.
Explicit
,
parameters
[
i
],
arguments
[
i
]));
}
return
argumentsInEvaluationBuilder
.
ToImmutableAndFree
();
;
return
argumentsInEvaluationBuilder
.
ToImmutableAndFree
();
}
ArrayBuilder
<
ParameterSymbol
>
missingParametersBuilder
=
ArrayBuilder
<
ParameterSymbol
>.
GetInstance
(
parameters
.
Length
);
...
...
@@ -551,7 +549,7 @@ private static bool IsSafeForReordering(BoundExpression expression, RefKind kind
// temporariesBuilder will be null when factory is null.
private
static
bool
CanSkipRewriting
(
ref
ImmutableArray
<
BoundExpression
>
rewrittenArguments
,
ImmutableArray
<
BoundExpression
>
rewrittenArguments
,
Symbol
methodOrIndexer
,
bool
expanded
,
ImmutableArray
<
int
>
argsToParamsOpt
,
...
...
@@ -701,10 +699,7 @@ private static ImmutableArray<RefKind> GetRefKindsOrNull(ArrayBuilder<RefKind> r
// Set loop variable so the value for next iteration will be the index of the first non param-array argument after param-array argument(s).
a
=
firstNonParamArrayArgumentIndex
-
1
;
var
paramArrayType
=
parameters
[
p
].
Type
;
var
arrayArgs
=
paramArray
.
ToImmutableAndFree
();
argument
=
CreateParamArrayArgument
(
syntax
,
paramArrayType
,
arrayArgs
,
null
,
binder
);
argument
=
CreateParamArrayArgument
(
syntax
,
parameter
.
Type
,
paramArray
.
ToImmutableAndFree
(),
null
,
binder
);
}
argumentsBuilder
.
Add
(
BoundCall
.
CreateArgumentOperation
(
kind
,
parameter
,
argument
));
...
...
src/Compilers/CSharp/Test/Semantic/IOperation/IOperationTests_IArgument.cs
浏览文件 @
c5e64fe0
...
...
@@ -850,7 +850,7 @@ class P
}
[
Fact
]
public
void
CallerInfoAttributesInvokedInFieldInitilizer
()
public
void
CallerInfoAttributesInvokedInFieldIniti
a
lizer
()
{
string
source
=
@"
using System.Runtime.CompilerServices;
...
...
src/Compilers/Test/Utilities/CSharp/SemanticModelTestBase.cs
浏览文件 @
c5e64fe0
...
...
@@ -302,7 +302,7 @@ protected void VerifyOperationTreeAndDiagnosticsForTest<TSyntaxNode>(CSharpCompi
CSharpParseOptions
parseOptions
=
null
,
MetadataReference
[]
additionalReferences
=
null
,
Action
<
IOperation
>
AdditionalOperationTreeVerifier
=
null
)
where
TSyntaxNode
:
SyntaxNode
where
TSyntaxNode
:
SyntaxNode
{
var
ilReference
=
CreateMetadataReferenceFromIlSource
(
ilSource
);
VerifyOperationTreeAndDiagnosticsForTest
<
TSyntaxNode
>(
testSrc
,
expectedOperationTree
,
expectedDiagnostics
,
compilationOptions
,
parseOptions
,
new
[]
{
ilReference
},
AdditionalOperationTreeVerifier
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录