Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
19bf7265
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,发现更多精彩内容 >>
提交
19bf7265
编写于
8月 14, 2017
作者:
M
Manish Vasani
提交者:
GitHub
8月 14, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #21363 from jinujoseph/Implicit1
Expose IsImplicit flag for all IOperation node
上级
7902721e
2618b53f
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
994 addition
and
785 deletion
+994
-785
src/Compilers/CSharp/Portable/Operations/CSharpConversionExpression.cs
.../CSharp/Portable/Operations/CSharpConversionExpression.cs
+6
-6
src/Compilers/CSharp/Portable/Operations/CSharpOperationCloner.cs
...ilers/CSharp/Portable/Operations/CSharpOperationCloner.cs
+1
-1
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
...lers/CSharp/Portable/Operations/CSharpOperationFactory.cs
+197
-100
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs
...arp/Portable/Operations/CSharpOperationFactory_Methods.cs
+5
-4
src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs
...ilers/Core/Portable/Generated/Operations.xml.Generated.cs
+432
-432
src/Compilers/Core/Portable/Operations/IOperation.cs
src/Compilers/Core/Portable/Operations/IOperation.cs
+5
-0
src/Compilers/Core/Portable/Operations/Operation.cs
src/Compilers/Core/Portable/Operations/Operation.cs
+11
-5
src/Compilers/Core/Portable/Operations/OperationCloner.cs
src/Compilers/Core/Portable/Operations/OperationCloner.cs
+88
-88
src/Compilers/Core/Portable/Operations/OperationFactory.cs
src/Compilers/Core/Portable/Operations/OperationFactory.cs
+27
-23
src/Compilers/Core/Portable/PublicAPI.Unshipped.txt
src/Compilers/Core/Portable/PublicAPI.Unshipped.txt
+6
-5
src/Compilers/VisualBasic/Portable/Operations/VisualBasicConversionExpression.vb
...ic/Portable/Operations/VisualBasicConversionExpression.vb
+6
-6
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationCloner.vb
...alBasic/Portable/Operations/VisualBasicOperationCloner.vb
+1
-1
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb
...lBasic/Portable/Operations/VisualBasicOperationFactory.vb
+168
-86
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb
...ortable/Operations/VisualBasicOperationFactory_Methods.vb
+38
-25
src/Test/Utilities/Portable/Diagnostics/CouldHaveMoreSpecificTypeAnalyzer.cs
...Portable/Diagnostics/CouldHaveMoreSpecificTypeAnalyzer.cs
+2
-1
src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs
...t/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs
+1
-2
未找到文件。
src/Compilers/CSharp/Portable/Operations/CSharpConversionExpression.cs
浏览文件 @
19bf7265
...
...
@@ -7,8 +7,8 @@ namespace Microsoft.CodeAnalysis.CSharp
{
internal
abstract
class
BaseCSharpConversionExpression
:
BaseConversionExpression
{
protected
BaseCSharpConversionExpression
(
Conversion
conversion
,
bool
isExplicitInCode
,
bool
isTryCast
,
bool
isChecked
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
isExplicitInCode
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
)
protected
BaseCSharpConversionExpression
(
Conversion
conversion
,
bool
isExplicitInCode
,
bool
isTryCast
,
bool
isChecked
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
isExplicitInCode
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
ConversionInternal
=
conversion
;
}
...
...
@@ -20,8 +20,8 @@ internal abstract class BaseCSharpConversionExpression : BaseConversionExpressio
internal
sealed
partial
class
CSharpConversionExpression
:
BaseCSharpConversionExpression
{
public
CSharpConversionExpression
(
IOperation
operand
,
Conversion
conversion
,
bool
isExplicit
,
bool
isTryCast
,
bool
isChecked
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
conversion
,
isExplicit
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
)
public
CSharpConversionExpression
(
IOperation
operand
,
Conversion
conversion
,
bool
isExplicit
,
bool
isTryCast
,
bool
isChecked
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
conversion
,
isExplicit
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
OperandImpl
=
operand
;
}
...
...
@@ -32,8 +32,8 @@ internal sealed partial class CSharpConversionExpression : BaseCSharpConversionE
internal
sealed
partial
class
LazyCSharpConversionExpression
:
BaseCSharpConversionExpression
{
private
readonly
Lazy
<
IOperation
>
_operand
;
public
LazyCSharpConversionExpression
(
Lazy
<
IOperation
>
operand
,
Conversion
conversion
,
bool
isExplicit
,
bool
isTryCast
,
bool
isChecked
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
:
base
(
conversion
,
isExplicit
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
)
public
LazyCSharpConversionExpression
(
Lazy
<
IOperation
>
operand
,
Conversion
conversion
,
bool
isExplicit
,
bool
isTryCast
,
bool
isChecked
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
conversion
,
isExplicit
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
_operand
=
operand
;
}
...
...
src/Compilers/CSharp/Portable/Operations/CSharpOperationCloner.cs
浏览文件 @
19bf7265
...
...
@@ -10,7 +10,7 @@ internal class CSharpOperationCloner : OperationCloner
public
override
IOperation
VisitConversionExpression
(
IConversionExpression
operation
,
object
argument
)
{
return
new
CSharpConversionExpression
(
Visit
(
operation
.
Operand
),
operation
.
GetConversion
(),
operation
.
IsExplicitInCode
,
operation
.
IsTryCast
,
operation
.
IsChecked
,
((
Operation
)
operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
);
return
new
CSharpConversionExpression
(
Visit
(
operation
.
Operand
),
operation
.
GetConversion
(),
operation
.
IsExplicitInCode
,
operation
.
IsTryCast
,
operation
.
IsChecked
,
((
Operation
)
operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
,
operation
.
IsImplicit
);
}
}
}
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
浏览文件 @
19bf7265
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs
浏览文件 @
19bf7265
...
...
@@ -44,7 +44,8 @@ internal IArgument CreateArgumentOperation(ArgumentKind kind, IParameterSymbol p
semanticModel
:
_semanticModel
,
syntax
:
value
.
Syntax
,
type
:
value
.
Type
,
constantValue
:
default
);
constantValue
:
default
,
isImplicit
:
expression
.
WasCompilerGenerated
);
}
private
ImmutableArray
<
IArgument
>
DeriveArguments
(
...
...
@@ -116,7 +117,7 @@ private ImmutableArray<IOperation> GetAnonymousObjectCreationInitializers(BoundA
SyntaxNode
syntax
=
value
.
Syntax
?.
Parent
??
expression
.
Syntax
;
ITypeSymbol
type
=
target
.
Type
;
Optional
<
object
>
constantValue
=
value
.
ConstantValue
;
var
assignment
=
new
SimpleAssignmentExpression
(
target
,
value
,
_semanticModel
,
syntax
,
type
,
constantValue
);
var
assignment
=
new
SimpleAssignmentExpression
(
target
,
value
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
:
value
.
IsImplicit
);
builder
.
Add
(
assignment
);
}
...
...
@@ -188,7 +189,7 @@ private ImmutableArray<ISwitchCase> GetSwitchStatementCases(BoundSwitchStatement
var
clauses
=
switchSection
.
SwitchLabels
.
SelectAsArray
(
s
=>
(
ICaseClause
)
Create
(
s
));
var
body
=
switchSection
.
Statements
.
SelectAsArray
(
s
=>
Create
(
s
));
return
(
ISwitchCase
)
new
SwitchCase
(
clauses
,
body
,
_semanticModel
,
switchSection
.
Syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>));
return
(
ISwitchCase
)
new
SwitchCase
(
clauses
,
body
,
_semanticModel
,
switchSection
.
Syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>)
,
isImplicit
:
switchSection
.
WasCompilerGenerated
);
});
}
...
...
@@ -199,7 +200,7 @@ private ImmutableArray<ISwitchCase> GetPatternSwitchStatementCases(BoundPatternS
var
clauses
=
switchSection
.
SwitchLabels
.
SelectAsArray
(
s
=>
(
ICaseClause
)
Create
(
s
));
var
body
=
switchSection
.
Statements
.
SelectAsArray
(
s
=>
Create
(
s
));
return
(
ISwitchCase
)
new
SwitchCase
(
clauses
,
body
,
_semanticModel
,
switchSection
.
Syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>));
return
(
ISwitchCase
)
new
SwitchCase
(
clauses
,
body
,
_semanticModel
,
switchSection
.
Syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>)
,
isImplicit
:
switchSection
.
WasCompilerGenerated
);
});
}
...
...
src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs
浏览文件 @
19bf7265
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
src/Compilers/Core/Portable/Operations/IOperation.cs
浏览文件 @
19bf7265
...
...
@@ -54,5 +54,10 @@ public interface IOperation
void
Accept
(
OperationVisitor
visitor
);
TResult
Accept
<
TArgument
,
TResult
>(
OperationVisitor
<
TArgument
,
TResult
>
visitor
,
TArgument
argument
);
/// <summary>
/// Set to True if compiler generated /implicitly computed by compiler code
/// </summary>
bool
IsImplicit
{
get
;
}
}
}
src/Compilers/Core/Portable/Operations/Operation.cs
浏览文件 @
19bf7265
...
...
@@ -24,7 +24,7 @@ internal abstract class Operation : IOperation
// but once initialized, will never change
private
IOperation
_parentDoNotAccessDirectly
;
public
Operation
(
OperationKind
kind
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
)
public
Operation
(
OperationKind
kind
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
{
SemanticModel
=
semanticModel
;
...
...
@@ -32,6 +32,7 @@ public Operation(OperationKind kind, SemanticModel semanticModel, SyntaxNode syn
Syntax
=
syntax
;
Type
=
type
;
ConstantValue
=
constantValue
;
IsImplicit
=
isImplicit
;
}
/// <summary>
...
...
@@ -50,6 +51,11 @@ public IOperation Parent
}
}
/// <summary>
/// Set to True if compiler generated /implicitly computed by compiler code
/// </summary>
public
bool
IsImplicit
{
get
;
}
/// <summary>
/// Identifies the kind of the operation.
/// </summary>
...
...
@@ -104,9 +110,9 @@ protected void SetParentOperation(IOperation parent)
///
/// Use this to create IOperation when we don't have proper specific IOperation yet for given language construct
/// </summary>
public
static
IOperation
CreateOperationNone
(
SemanticModel
semanticModel
,
SyntaxNode
node
,
Optional
<
object
>
constantValue
,
Func
<
ImmutableArray
<
IOperation
>>
getChildren
)
public
static
IOperation
CreateOperationNone
(
SemanticModel
semanticModel
,
SyntaxNode
node
,
Optional
<
object
>
constantValue
,
Func
<
ImmutableArray
<
IOperation
>>
getChildren
,
bool
isImplicit
)
{
return
new
NoneOperation
(
semanticModel
,
node
,
constantValue
,
getChildren
);
return
new
NoneOperation
(
semanticModel
,
node
,
constantValue
,
getChildren
,
isImplicit
);
}
public
static
T
SetParentOperation
<
T
>(
T
operation
,
IOperation
parent
)
where
T
:
IOperation
...
...
@@ -160,8 +166,8 @@ private class NoneOperation : Operation
{
private
readonly
Func
<
ImmutableArray
<
IOperation
>>
_getChildren
;
public
NoneOperation
(
SemanticModel
semanticModel
,
SyntaxNode
node
,
Optional
<
object
>
constantValue
,
Func
<
ImmutableArray
<
IOperation
>>
getChildren
)
:
base
(
OperationKind
.
None
,
semanticModel
,
node
,
type
:
null
,
constantValue
:
constantValue
)
public
NoneOperation
(
SemanticModel
semanticModel
,
SyntaxNode
node
,
Optional
<
object
>
constantValue
,
Func
<
ImmutableArray
<
IOperation
>>
getChildren
,
bool
isImplicit
)
:
base
(
OperationKind
.
None
,
semanticModel
,
node
,
type
:
null
,
constantValue
:
constantValue
,
isImplicit
:
isImplicit
)
{
_getChildren
=
getChildren
;
}
...
...
src/Compilers/Core/Portable/Operations/OperationCloner.cs
浏览文件 @
19bf7265
此差异已折叠。
点击以展开。
src/Compilers/Core/Portable/Operations/OperationFactory.cs
浏览文件 @
19bf7265
...
...
@@ -20,10 +20,11 @@ public static VariableDeclaration CreateVariableDeclaration(ImmutableArray<ILoca
semanticModel
,
syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>));
constantValue
:
default
(
Optional
<
object
>),
isImplicit
:
false
);
// variable declaration is always explicit
}
public
static
IConditionalChoiceExpression
CreateConditionalChoiceExpression
(
IOperation
condition
,
IOperation
ifTrue
,
IOperation
ifFalse
,
ITypeSymbol
resultType
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
)
public
static
IConditionalChoiceExpression
CreateConditionalChoiceExpression
(
IOperation
condition
,
IOperation
ifTrue
,
IOperation
ifFalse
,
ITypeSymbol
resultType
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
bool
isImplicit
)
{
return
new
ConditionalChoiceExpression
(
condition
,
...
...
@@ -32,17 +33,18 @@ public static IConditionalChoiceExpression CreateConditionalChoiceExpression(IOp
semanticModel
,
syntax
,
resultType
,
default
(
Optional
<
object
>));
default
(
Optional
<
object
>),
isImplicit
);
}
public
static
IExpressionStatement
CreateSimpleAssignmentExpressionStatement
(
IOperation
target
,
IOperation
value
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
)
public
static
IExpressionStatement
CreateSimpleAssignmentExpressionStatement
(
IOperation
target
,
IOperation
value
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
bool
isImplicit
)
{
var
expression
=
new
SimpleAssignmentExpression
(
target
,
value
,
semanticModel
,
syntax
,
target
.
Type
,
default
(
Optional
<
object
>));
return
new
ExpressionStatement
(
expression
,
semanticModel
,
syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>));
var
expression
=
new
SimpleAssignmentExpression
(
target
,
value
,
semanticModel
,
syntax
,
target
.
Type
,
default
(
Optional
<
object
>)
,
isImplicit
);
return
new
ExpressionStatement
(
expression
,
semanticModel
,
syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>)
,
isImplicit
:
isImplicit
);
}
public
static
IExpressionStatement
CreateCompoundAssignmentExpressionStatement
(
IOperation
target
,
IOperation
value
,
BinaryOperationKind
binaryOperationKind
,
bool
isLifted
,
IMethodSymbol
operatorMethod
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
)
IOperation
target
,
IOperation
value
,
BinaryOperationKind
binaryOperationKind
,
bool
isLifted
,
IMethodSymbol
operatorMethod
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
bool
isImplicit
)
{
var
expression
=
new
CompoundAssignmentExpression
(
binaryOperationKind
,
...
...
@@ -54,52 +56,54 @@ public static IExpressionStatement CreateSimpleAssignmentExpressionStatement(IOp
semanticModel
,
syntax
,
target
.
Type
,
default
(
Optional
<
object
>));
default
(
Optional
<
object
>),
isImplicit
);
return
new
ExpressionStatement
(
expression
,
semanticModel
,
syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>));
return
new
ExpressionStatement
(
expression
,
semanticModel
,
syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>)
,
isImplicit
:
isImplicit
);
}
public
static
ILiteralExpression
CreateLiteralExpression
(
long
value
,
ITypeSymbol
resultType
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
)
public
static
ILiteralExpression
CreateLiteralExpression
(
long
value
,
ITypeSymbol
resultType
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
bool
isImplicit
)
{
return
new
LiteralExpression
(
value
.
ToString
(),
semanticModel
,
syntax
,
resultType
,
constantValue
:
new
Optional
<
object
>(
value
));
return
new
LiteralExpression
(
value
.
ToString
(),
semanticModel
,
syntax
,
resultType
,
constantValue
:
new
Optional
<
object
>(
value
)
,
isImplicit
:
isImplicit
);
}
public
static
ILiteralExpression
CreateLiteralExpression
(
ConstantValue
value
,
ITypeSymbol
resultType
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
)
public
static
ILiteralExpression
CreateLiteralExpression
(
ConstantValue
value
,
ITypeSymbol
resultType
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
bool
isImplicit
)
{
return
new
LiteralExpression
(
value
.
GetValueToDisplay
(),
semanticModel
,
syntax
,
resultType
,
new
Optional
<
object
>(
value
.
Value
));
return
new
LiteralExpression
(
value
.
GetValueToDisplay
(),
semanticModel
,
syntax
,
resultType
,
new
Optional
<
object
>(
value
.
Value
)
,
isImplicit
);
}
public
static
IBinaryOperatorExpression
CreateBinaryOperatorExpression
(
BinaryOperationKind
binaryOperationKind
,
IOperation
left
,
IOperation
right
,
ITypeSymbol
resultType
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
bool
isLifted
)
BinaryOperationKind
binaryOperationKind
,
IOperation
left
,
IOperation
right
,
ITypeSymbol
resultType
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
bool
isLifted
,
bool
isImplicit
)
{
return
new
BinaryOperatorExpression
(
binaryOperationKind
,
left
,
right
,
isLifted
:
isLifted
,
usesOperatorMethod
:
false
,
operatorMethod
:
null
,
semanticModel
:
semanticModel
,
syntax
:
syntax
,
type
:
resultType
,
constantValue
:
default
);
semanticModel
:
semanticModel
,
syntax
:
syntax
,
type
:
resultType
,
constantValue
:
default
,
isImplicit
:
isImplicit
);
}
public
static
IArrayCreationExpression
CreateArrayCreationExpression
(
IArrayTypeSymbol
arrayType
,
ImmutableArray
<
IOperation
>
elementValues
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
)
IArrayTypeSymbol
arrayType
,
ImmutableArray
<
IOperation
>
elementValues
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
bool
isImplicit
)
{
var
initializer
=
new
ArrayInitializer
(
elementValues
,
semanticModel
,
syntax
,
arrayType
,
default
(
Optional
<
object
>));
var
initializer
=
new
ArrayInitializer
(
elementValues
,
semanticModel
,
syntax
,
arrayType
,
default
(
Optional
<
object
>)
,
isImplicit
);
return
new
ArrayCreationExpression
(
arrayType
.
ElementType
,
ImmutableArray
.
Create
<
IOperation
>(
CreateLiteralExpression
(
elementValues
.
Count
(),
resultType
:
null
,
semanticModel
:
semanticModel
,
syntax
:
syntax
)),
ImmutableArray
.
Create
<
IOperation
>(
CreateLiteralExpression
(
elementValues
.
Count
(),
resultType
:
null
,
semanticModel
:
semanticModel
,
syntax
:
syntax
,
isImplicit
:
isImplicit
)),
initializer
,
semanticModel
,
syntax
,
arrayType
,
default
(
Optional
<
object
>));
default
(
Optional
<
object
>),
isImplicit
);
}
public
static
IInvalidExpression
CreateInvalidExpression
(
SemanticModel
semanticModel
,
SyntaxNode
syntax
)
public
static
IInvalidExpression
CreateInvalidExpression
(
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
bool
isImplicit
)
{
return
CreateInvalidExpression
(
semanticModel
,
syntax
,
ImmutableArray
<
IOperation
>.
Empty
);
return
CreateInvalidExpression
(
semanticModel
,
syntax
,
ImmutableArray
<
IOperation
>.
Empty
,
isImplicit
);
}
public
static
IInvalidExpression
CreateInvalidExpression
(
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ImmutableArray
<
IOperation
>
children
)
public
static
IInvalidExpression
CreateInvalidExpression
(
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ImmutableArray
<
IOperation
>
children
,
bool
isImplicit
)
{
return
new
InvalidExpression
(
children
,
semanticModel
,
syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>));
return
new
InvalidExpression
(
children
,
semanticModel
,
syntax
,
type
:
null
,
constantValue
:
default
(
Optional
<
object
>)
,
isImplicit
:
isImplicit
);
}
}
}
src/Compilers/Core/Portable/PublicAPI.Unshipped.txt
浏览文件 @
19bf7265
*REMOVED*Microsoft.CodeAnalysis.Compilation.Emit(System.IO.Stream peStream, System.IO.Stream pdbStream = null, System.IO.Stream xmlDocumentationStream = null, System.IO.Stream win32Resources = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ResourceDescription> manifestResources = null, Microsoft.CodeAnalysis.Emit.EmitOptions options = null, Microsoft.CodeAnalysis.IMethodSymbol debugEntryPoint = null, System.IO.Stream sourceLinkStream = null, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.EmbeddedText> embeddedTexts = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Emit.EmitResult
*REMOVED*Microsoft.CodeAnalysis.Emit.EmitOptions.EmitOptions(bool metadataOnly = false, Microsoft.CodeAnalysis.Emit.DebugInformationFormat debugInformationFormat = (Microsoft.CodeAnalysis.Emit.DebugInformationFormat)0, string pdbFilePath = null, string outputNameOverride = null, int fileAlignment = 0, ulong baseAddress = 0, bool highEntropyVirtualAddressSpace = false, Microsoft.CodeAnalysis.SubsystemVersion subsystemVersion = default(Microsoft.CodeAnalysis.SubsystemVersion), string runtimeMetadataVersion = null, bool tolerateErrors = false, bool includePrivateMembers = false, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Emit.InstrumentationKind> instrumentationKinds = default(System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.Emit.InstrumentationKind>)) -> void
*REMOVED*Microsoft.CodeAnalysis.IOperation.IsInvalid.get -> bool
abstract Microsoft.CodeAnalysis.SemanticModel.RootCore.get -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.CommandLineArguments.DisplayLangVersions.get -> bool
Microsoft.CodeAnalysis.Diagnostics.AnalysisContext.RegisterOperationAction(System.Action<Microsoft.CodeAnalysis.Diagnostics.OperationAnalysisContext> action, params Microsoft.CodeAnalysis.OperationKind[] operationKinds) -> void
Microsoft.CodeAnalysis.Diagnostics.CompilationStartAnalysisContext.RegisterOperationAction(System.Action<Microsoft.CodeAnalysis.Diagnostics.OperationAnalysisContext> action, params Microsoft.CodeAnalysis.OperationKind[] operationKinds) -> void
...
...
@@ -42,11 +41,12 @@ Microsoft.CodeAnalysis.IOperation.Accept(Microsoft.CodeAnalysis.Semantics.Operat
Microsoft.CodeAnalysis.IOperation.Accept<TArgument, TResult>(Microsoft.CodeAnalysis.Semantics.OperationVisitor<TArgument, TResult> visitor, TArgument argument) -> TResult
Microsoft.CodeAnalysis.IOperation.Children.get -> System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.IOperation>
Microsoft.CodeAnalysis.IOperation.ConstantValue.get -> Microsoft.CodeAnalysis.Optional<object>
Microsoft.CodeAnalysis.IOperation.IsImplicit.get -> bool
Microsoft.CodeAnalysis.IOperation.Kind.get -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.IOperation.Language.get -> string
Microsoft.CodeAnalysis.IOperation.Parent.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.IOperation.Syntax.get -> Microsoft.CodeAnalysis.SyntaxNode
Microsoft.CodeAnalysis.IOperation.Type.get -> Microsoft.CodeAnalysis.ITypeSymbol
Microsoft.CodeAnalysis.IOperation.Parent.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.AddressOfExpression = 515 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.AnonymousObjectCreationExpression = 287 -> Microsoft.CodeAnalysis.OperationKind
...
...
@@ -69,8 +69,8 @@ Microsoft.CodeAnalysis.OperationKind.ConversionExpression = 258 -> Microsoft.Cod
Microsoft.CodeAnalysis.OperationKind.DeclarationPattern = 1040 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.DefaultCaseClause = 1042 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.DefaultValueExpression = 512 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.DynamicObjectCreationExpression = 293 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.DynamicMemberReferenceExpression = 294 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.DynamicObjectCreationExpression = 293 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.EmptyStatement = 9 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.EndStatement = 81 -> Microsoft.CodeAnalysis.OperationKind
Microsoft.CodeAnalysis.OperationKind.EventAssignmentExpression = 283 -> Microsoft.CodeAnalysis.OperationKind
...
...
@@ -365,9 +365,9 @@ Microsoft.CodeAnalysis.Semantics.IAwaitExpression
Microsoft.CodeAnalysis.Semantics.IAwaitExpression.AwaitedValue.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IBinaryOperatorExpression
Microsoft.CodeAnalysis.Semantics.IBinaryOperatorExpression.BinaryOperationKind.get -> Microsoft.CodeAnalysis.Semantics.BinaryOperationKind
Microsoft.CodeAnalysis.Semantics.IBinaryOperatorExpression.IsLifted.get -> bool
Microsoft.CodeAnalysis.Semantics.IBinaryOperatorExpression.LeftOperand.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IBinaryOperatorExpression.RightOperand.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IBinaryOperatorExpression.IsLifted.get -> bool
Microsoft.CodeAnalysis.Semantics.IBlockStatement
Microsoft.CodeAnalysis.Semantics.IBlockStatement.Locals.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.ILocalSymbol>
Microsoft.CodeAnalysis.Semantics.IBlockStatement.Statements.get -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.IOperation>
...
...
@@ -579,9 +579,9 @@ Microsoft.CodeAnalysis.Semantics.ITypeOperationExpression.TypeOperand.get -> Mic
Microsoft.CodeAnalysis.Semantics.ITypeParameterObjectCreationExpression
Microsoft.CodeAnalysis.Semantics.ITypeParameterObjectCreationExpression.Initializer.get -> Microsoft.CodeAnalysis.Semantics.IObjectOrCollectionInitializerExpression
Microsoft.CodeAnalysis.Semantics.IUnaryOperatorExpression
Microsoft.CodeAnalysis.Semantics.IUnaryOperatorExpression.IsLifted.get -> bool
Microsoft.CodeAnalysis.Semantics.IUnaryOperatorExpression.Operand.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IUnaryOperatorExpression.UnaryOperationKind.get -> Microsoft.CodeAnalysis.Semantics.UnaryOperationKind
Microsoft.CodeAnalysis.Semantics.IUnaryOperatorExpression.IsLifted.get -> bool
Microsoft.CodeAnalysis.Semantics.IUsingStatement
Microsoft.CodeAnalysis.Semantics.IUsingStatement.Body.get -> Microsoft.CodeAnalysis.IOperation
Microsoft.CodeAnalysis.Semantics.IUsingStatement.Declaration.get -> Microsoft.CodeAnalysis.Semantics.IVariableDeclarationStatement
...
...
@@ -746,6 +746,7 @@ Microsoft.CodeAnalysis.SyntaxTriviaList.SyntaxTriviaList(params Microsoft.CodeAn
abstract Microsoft.CodeAnalysis.Diagnostics.OperationBlockStartAnalysisContext.RegisterOperationAction(System.Action<Microsoft.CodeAnalysis.Diagnostics.OperationAnalysisContext> action, System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.OperationKind> operationKinds) -> void
abstract Microsoft.CodeAnalysis.Diagnostics.OperationBlockStartAnalysisContext.RegisterOperationBlockEndAction(System.Action<Microsoft.CodeAnalysis.Diagnostics.OperationBlockAnalysisContext> action) -> void
abstract Microsoft.CodeAnalysis.SemanticModel.GetOperationCore(Microsoft.CodeAnalysis.SyntaxNode node, System.Threading.CancellationToken cancellationToken) -> Microsoft.CodeAnalysis.IOperation
abstract Microsoft.CodeAnalysis.SemanticModel.RootCore.get -> Microsoft.CodeAnalysis.SyntaxNode
override Microsoft.CodeAnalysis.Optional<T>.ToString() -> string
override Microsoft.CodeAnalysis.Semantics.OperationWalker.DefaultVisit(Microsoft.CodeAnalysis.IOperation operation) -> void
override Microsoft.CodeAnalysis.Semantics.OperationWalker.Visit(Microsoft.CodeAnalysis.IOperation operation) -> void
...
...
src/Compilers/VisualBasic/Portable/Operations/VisualBasicConversionExpression.vb
浏览文件 @
19bf7265
...
...
@@ -7,8 +7,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Friend
MustInherit
Class
BaseVisualBasicConversionExpression
Inherits
BaseConversionExpression
Protected
Sub
New
(
conversion
As
Conversion
,
isExplicitInCode
As
Boolean
,
isTryCast
As
Boolean
,
isChecked
As
Boolean
,
semanticModel
As
SemanticModel
,
syntax
As
SyntaxNode
,
type
As
ITypeSymbol
,
constantValue
As
[
Optional
]
(
Of
Object
))
MyBase
.
New
(
isExplicitInCode
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
)
Protected
Sub
New
(
conversion
As
Conversion
,
isExplicitInCode
As
Boolean
,
isTryCast
As
Boolean
,
isChecked
As
Boolean
,
semanticModel
As
SemanticModel
,
syntax
As
SyntaxNode
,
type
As
ITypeSymbol
,
constantValue
As
[
Optional
]
(
Of
Object
)
,
isImplicit
As
Boolean
)
MyBase
.
New
(
isExplicitInCode
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
ConversionInternal
=
conversion
End
Sub
...
...
@@ -21,8 +21,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Friend
NotInheritable
Class
VisualBasicConversionExpression
Inherits
BaseVisualBasicConversionExpression
Public
Sub
New
(
operand
As
IOperation
,
conversion
As
Conversion
,
isExplicitInCode
As
Boolean
,
isTryCast
As
Boolean
,
isChecked
As
Boolean
,
semanticModel
As
SemanticModel
,
syntax
As
SyntaxNode
,
type
As
ITypeSymbol
,
constantValue
As
[
Optional
]
(
Of
Object
))
MyBase
.
New
(
conversion
,
isExplicitInCode
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
)
Public
Sub
New
(
operand
As
IOperation
,
conversion
As
Conversion
,
isExplicitInCode
As
Boolean
,
isTryCast
As
Boolean
,
isChecked
As
Boolean
,
semanticModel
As
SemanticModel
,
syntax
As
SyntaxNode
,
type
As
ITypeSymbol
,
constantValue
As
[
Optional
]
(
Of
Object
)
,
isImplicit
As
Boolean
)
MyBase
.
New
(
conversion
,
isExplicitInCode
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
Me
.
OperandImpl
=
operand
End
Sub
...
...
@@ -35,8 +35,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Private
ReadOnly
_operandLazy
As
Lazy
(
Of
IOperation
)
Public
Sub
New
(
operandLazy
As
Lazy
(
Of
IOperation
),
conversion
As
Conversion
,
isExplicitInCode
As
Boolean
,
isTryCast
As
Boolean
,
isChecked
As
Boolean
,
semanticModel
As
SemanticModel
,
syntax
As
SyntaxNode
,
type
As
ITypeSymbol
,
constantValue
As
[
Optional
]
(
Of
Object
))
MyBase
.
New
(
conversion
,
isExplicitInCode
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
)
Public
Sub
New
(
operandLazy
As
Lazy
(
Of
IOperation
),
conversion
As
Conversion
,
isExplicitInCode
As
Boolean
,
isTryCast
As
Boolean
,
isChecked
As
Boolean
,
semanticModel
As
SemanticModel
,
syntax
As
SyntaxNode
,
type
As
ITypeSymbol
,
constantValue
As
[
Optional
]
(
Of
Object
)
,
isImplicit
As
Boolean
)
MyBase
.
New
(
conversion
,
isExplicitInCode
,
isTryCast
,
isChecked
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
_operandLazy
=
operandLazy
End
Sub
...
...
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationCloner.vb
浏览文件 @
19bf7265
...
...
@@ -8,7 +8,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Public
Shared
ReadOnly
Property
Instance
As
OperationCloner
=
New
VisualBasicOperationCloner
()
Public
Overrides
Function
VisitConversionExpression
(
operation
As
IConversionExpression
,
argument
As
Object
)
As
IOperation
Return
New
VisualBasicConversionExpression
(
Visit
(
operation
.
Operand
),
operation
.
GetConversion
(),
operation
.
IsExplicitInCode
,
operation
.
IsTryCast
,
operation
.
IsChecked
,
DirectCast
(
operation
,
Operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
)
Return
New
VisualBasicConversionExpression
(
Visit
(
operation
.
Operand
),
operation
.
GetConversion
(),
operation
.
IsExplicitInCode
,
operation
.
IsTryCast
,
operation
.
IsChecked
,
DirectCast
(
operation
,
Operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
,
operation
.
IsImplicit
)
End
Function
End
Class
End
Namespace
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb
浏览文件 @
19bf7265
此差异已折叠。
点击以展开。
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory_Methods.vb
浏览文件 @
19bf7265
...
...
@@ -41,8 +41,8 @@ Namespace Microsoft.CodeAnalysis.Semantics
If
child
IsNot
Nothing
Then
Return
child
End
If
Return
OperationFactory
.
CreateInvalidExpression
(
_semanticModel
,
[
operator
]
.
UnderlyingExpression
.
Syntax
,
ImmutableArray
(
Of
IOperation
).
Empty
)
Dim
isImplicit
As
Boolean
=
[
operator
]
.
WasCompilerGenerated
Return
OperationFactory
.
CreateInvalidExpression
(
_semanticModel
,
[
operator
]
.
UnderlyingExpression
.
Syntax
,
ImmutableArray
(
Of
IOperation
).
Empty
,
isImplicit
)
End
Function
Private
Shared
Function
GetUserDefinedBinaryOperatorChildBoundNode
(
[
operator
]
As
BoundUserDefinedBinaryOperator
,
index
As
Integer
)
As
BoundNode
...
...
@@ -72,6 +72,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
End
Function
Private
Function
DeriveArgument
(
index
As
Integer
,
argument
As
BoundExpression
,
parameters
As
ImmutableArray
(
Of
VisualBasic
.
Symbols
.
ParameterSymbol
))
As
IArgument
Dim
isImplicit
As
Boolean
=
argument
.
WasCompilerGenerated
Select
Case
argument
.
Kind
Case
BoundKind
.
ByRefArgumentWithCopyBack
Dim
byRefArgument
=
DirectCast
(
argument
,
BoundByRefArgumentWithCopyBack
)
...
...
@@ -86,7 +87,8 @@ Namespace Microsoft.CodeAnalysis.Semantics
_semanticModel
,
value
.
Syntax
,
type
:
=
Nothing
,
constantValue
:
=
Nothing
)
constantValue
:
=
Nothing
,
isImplicit
:
=
isImplicit
)
Case
Else
Dim
lastParameterIndex
=
parameters
.
Length
-
1
If
index
=
lastParameterIndex
AndAlso
ParameterIsParamArray
(
parameters
(
lastParameterIndex
))
Then
...
...
@@ -107,7 +109,8 @@ Namespace Microsoft.CodeAnalysis.Semantics
semanticModel
:
=
_semanticModel
,
syntax
:
=
value
.
Syntax
,
type
:
=
Nothing
,
constantValue
:
=
Nothing
)
constantValue
:
=
Nothing
,
isImplicit
:
=
isImplicit
)
Else
' TODO: figure our if this is true:
' a compiler generated argument for an Optional parameter is created iff
...
...
@@ -126,7 +129,8 @@ Namespace Microsoft.CodeAnalysis.Semantics
semanticModel
:
=
_semanticModel
,
syntax
:
=
value
.
Syntax
,
type
:
=
Nothing
,
constantValue
:
=
Nothing
)
constantValue
:
=
Nothing
,
isImplicit
:
=
isImplicit
)
End
If
End
Select
End
Function
...
...
@@ -140,8 +144,8 @@ Namespace Microsoft.CodeAnalysis.Semantics
If
child
IsNot
Nothing
Then
Return
child
End
If
Return
OperationFactory
.
CreateInvalidExpression
(
_semanticModel
,
parent
.
Syntax
,
ImmutableArray
(
Of
IOperation
).
Empty
)
Dim
isImplicit
As
Boolean
=
parent
.
WasCompilerGenerated
Return
OperationFactory
.
CreateInvalidExpression
(
_semanticModel
,
parent
.
Syntax
,
ImmutableArray
(
Of
IOperation
).
Empty
,
isImplicit
)
End
Function
Private
Shared
Function
GetChildOfBadExpressionBoundNode
(
parent
As
BoundNode
,
index
As
Integer
)
As
BoundNode
...
...
@@ -175,7 +179,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim
syntax
As
SyntaxNode
=
If
(
value
.
Syntax
?
.
Parent
,
expression
.
Syntax
)
Dim
type
As
ITypeSymbol
=
target
.
Type
Dim
constantValue
As
[
Optional
]
(
Of
Object
)
=
value
.
ConstantValue
Dim
assignment
=
New
SimpleAssignmentExpression
(
target
,
value
,
_semanticModel
,
syntax
,
type
,
constantValue
)
Dim
assignment
=
New
SimpleAssignmentExpression
(
target
,
value
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
:
=
value
.
IsImplicit
)
builder
.
Add
(
assignment
)
Next
i
...
...
@@ -189,20 +193,22 @@ Namespace Microsoft.CodeAnalysis.Semantics
' so we explicitly create an IOperation node for Case-Else clause to differentiate it from Case clause.
Dim
clauses
As
ImmutableArray
(
Of
ICaseClause
)
Dim
caseStatement
=
boundCaseBlock
.
CaseStatement
Dim
isImplicit
As
Boolean
=
boundCaseBlock
.
WasCompilerGenerated
If
caseStatement
.
CaseClauses
.
IsEmpty
AndAlso
caseStatement
.
Syntax
.
Kind
()
=
SyntaxKind
.
CaseElseStatement
Then
clauses
=
ImmutableArray
.
Create
(
Of
ICaseClause
)(
New
DefaultCaseClause
(
_semanticModel
,
caseStatement
.
Syntax
,
type
:
=
Nothing
,
constantValue
:
=
Nothing
))
constantValue
:
=
Nothing
,
isImplicit
:
=
isImplicit
))
Else
clauses
=
caseStatement
.
CaseClauses
.
SelectAsArray
(
Function
(
n
)
DirectCast
(
Create
(
n
),
ICaseClause
))
End
If
Dim
body
=
ImmutableArray
.
Create
(
Create
(
boundCaseBlock
.
Body
))
Dim
syntax
=
boundCaseBlock
.
Syntax
Return
DirectCast
(
New
SwitchCase
(
clauses
,
body
,
_semanticModel
,
syntax
,
type
:
=
Nothing
,
constantValue
:
=
Nothing
),
ISwitchCase
)
Return
DirectCast
(
New
SwitchCase
(
clauses
,
body
,
_semanticModel
,
syntax
,
type
:
=
Nothing
,
constantValue
:
=
Nothing
,
isImplicit
:
=
isImplicit
),
ISwitchCase
)
End
Function
)
End
Function
...
...
@@ -264,7 +270,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
' ControlVariable = InitialValue
If
controlVariable
IsNot
Nothing
Then
statements
.
Add
(
OperationFactory
.
CreateSimpleAssignmentExpressionStatement
(
Create
(
controlVariable
),
Create
(
initialValue
),
_semanticModel
,
initialValue
.
Syntax
))
statements
.
Add
(
OperationFactory
.
CreateSimpleAssignmentExpressionStatement
(
Create
(
controlVariable
),
Create
(
initialValue
),
_semanticModel
,
initialValue
.
Syntax
,
isImplicit
:
=
controlVariable
.
WasCompilerGenerated
))
End
If
' T0 = LimitValue
...
...
@@ -276,7 +282,8 @@ Namespace Microsoft.CodeAnalysis.Semantics
_semanticModel
,
limitValue
.
Syntax
,
limitValue
.
Type
,
constantValue
:
=
Nothing
),
limitValue
,
_semanticModel
,
limitValue
.
Syntax
))
constantValue
:
=
Nothing
,
isImplicit
:
=
limitValue
.
IsImplicit
),
limitValue
,
_semanticModel
,
limitValue
.
Syntax
,
limitValue
.
IsImplicit
))
End
If
' T1 = StepValue
...
...
@@ -288,7 +295,8 @@ Namespace Microsoft.CodeAnalysis.Semantics
_semanticModel
,
stepValue
.
Syntax
,
stepValue
.
Type
,
constantValue
:
=
Nothing
),
stepValue
,
_semanticModel
,
stepValue
.
Syntax
))
constantValue
:
=
Nothing
,
isImplicit
:
=
stepValue
.
IsImplicit
),
stepValue
,
_semanticModel
,
stepValue
.
Syntax
,
stepValue
.
IsImplicit
))
End
If
Return
statements
.
ToImmutableAndFree
()
...
...
@@ -316,11 +324,12 @@ Namespace Microsoft.CodeAnalysis.Semantics
_semanticModel
,
value
.
Syntax
,
value
.
Type
,
constantValue
:
=
Nothing
))
constantValue
:
=
Nothing
,
isImplicit
:
=
value
.
IsImplicit
))
statements
.
Add
(
OperationFactory
.
CreateCompoundAssignmentExpressionStatement
(
controlVariable
,
stepOperand
,
Expression
.
DeriveAdditionKind
(
controlType
.
GetNullableUnderlyingTypeOrSelf
()),
controlType
.
IsNullableType
(),
Nothing
,
_semanticModel
,
stepValueExpression
.
Syntax
))
Nothing
,
_semanticModel
,
stepValueExpression
.
Syntax
,
value
.
IsImplicit
))
End
If
End
If
...
...
@@ -342,7 +351,8 @@ Namespace Microsoft.CodeAnalysis.Semantics
_semanticModel
,
limitValueOperation
.
Syntax
,
limitValueOperation
.
Type
,
constantValue
:
=
Nothing
))
constantValue
:
=
Nothing
,
isImplicit
:
=
limitValueOperation
.
IsImplicit
))
' controlVariable can be a BoundBadExpression in case of error
Dim
booleanType
As
ITypeSymbol
=
controlVariable
.
ExpressionSymbol
?
.
DeclaringCompilation
.
GetSpecialType
(
SpecialType
.
System_Boolean
)
...
...
@@ -364,7 +374,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim
relationalCode
As
BinaryOperationKind
=
Helper
.
DeriveBinaryOperationKind
(
If
(
stepValue
IsNot
Nothing
AndAlso
stepValue
.
ConstantValueOpt
.
IsNegativeNumeric
,
BinaryOperatorKind
.
GreaterThanOrEqual
,
BinaryOperatorKind
.
LessThanOrEqual
),
controlVariable
)
Return
OperationFactory
.
CreateBinaryOperatorExpression
(
relationalCode
,
_semanticModel
.
CloneOperation
(
Create
(
controlVariable
)),
limitValueReference
,
booleanType
,
_semanticModel
,
limitValueReference
.
Syntax
,
isLifted
)
relationalCode
,
_semanticModel
.
CloneOperation
(
Create
(
controlVariable
)),
limitValueReference
,
booleanType
,
_semanticModel
,
limitValueReference
.
Syntax
,
isLifted
,
limitValueReference
.
IsImplicit
)
Else
' If(StepValue >= 0, ControlVariable <= LimitValue, ControlVariable >= LimitValue)
Dim
value
=
Create
(
stepValue
)
...
...
@@ -373,25 +383,27 @@ Namespace Microsoft.CodeAnalysis.Semantics
_semanticModel
,
value
.
Syntax
,
value
.
Type
,
constantValue
:
=
Nothing
)
constantValue
:
=
Nothing
,
isImplicit
:
=
value
.
IsImplicit
)
Dim
stepRelationalCode
As
BinaryOperationKind
=
Helper
.
DeriveBinaryOperationKind
(
BinaryOperatorKind
.
GreaterThanOrEqual
,
stepValue
)
Dim
stepConditionIsLifted
=
stepValue
.
Type
.
IsNullableType
()
Dim
stepCondition
As
IOperation
=
OperationFactory
.
CreateBinaryOperatorExpression
(
stepRelationalCode
,
stepValueReference
,
OperationFactory
.
CreateLiteralExpression
(
Semantics
.
Expression
.
SynthesizeNumeric
(
stepValueReference
.
Type
,
0
),
stepValue
.
Type
,
_semanticModel
,
stepValue
.
Syntax
),
OperationFactory
.
CreateLiteralExpression
(
Semantics
.
Expression
.
SynthesizeNumeric
(
stepValueReference
.
Type
,
0
),
stepValue
.
Type
,
_semanticModel
,
stepValue
.
Syntax
,
stepValueReference
.
IsImplicit
),
booleanType
,
_semanticModel
,
stepValue
.
Syntax
,
stepConditionIsLifted
)
stepConditionIsLifted
,
stepValue
.
WasCompilerGenerated
)
Dim
positiveStepRelationalCode
As
BinaryOperationKind
=
Helper
.
DeriveBinaryOperationKind
(
BinaryOperatorKind
.
LessThanOrEqual
,
controlVariable
)
Dim
positiveStepCondition
As
IOperation
=
OperationFactory
.
CreateBinaryOperatorExpression
(
positiveStepRelationalCode
,
_semanticModel
.
CloneOperation
(
Create
(
controlVariable
)),
limitValueReference
,
booleanType
,
_semanticModel
,
limitValueReference
.
Syntax
,
isLifted
)
Dim
positiveStepCondition
As
IOperation
=
OperationFactory
.
CreateBinaryOperatorExpression
(
positiveStepRelationalCode
,
_semanticModel
.
CloneOperation
(
Create
(
controlVariable
)),
limitValueReference
,
booleanType
,
_semanticModel
,
limitValueReference
.
Syntax
,
isLifted
,
limitValueReference
.
IsImplicit
)
Dim
negativeStepRelationalCode
As
BinaryOperationKind
=
Helper
.
DeriveBinaryOperationKind
(
BinaryOperatorKind
.
GreaterThanOrEqual
,
controlVariable
)
Dim
negativeStepCondition
As
IOperation
=
OperationFactory
.
CreateBinaryOperatorExpression
(
negativeStepRelationalCode
,
_semanticModel
.
CloneOperation
(
Create
(
controlVariable
)),
_semanticModel
.
CloneOperation
(
limitValueReference
),
booleanType
,
_semanticModel
,
limitValueReference
.
Syntax
,
isLifted
)
Dim
negativeStepCondition
As
IOperation
=
OperationFactory
.
CreateBinaryOperatorExpression
(
negativeStepRelationalCode
,
_semanticModel
.
CloneOperation
(
Create
(
controlVariable
)),
_semanticModel
.
CloneOperation
(
limitValueReference
),
booleanType
,
_semanticModel
,
limitValueReference
.
Syntax
,
isLifted
,
limitValueReference
.
IsImplicit
)
Return
OperationFactory
.
CreateConditionalChoiceExpression
(
stepCondition
,
positiveStepCondition
,
negativeStepCondition
,
booleanType
,
_semanticModel
,
limitValueReference
.
Syntax
)
Return
OperationFactory
.
CreateConditionalChoiceExpression
(
stepCondition
,
positiveStepCondition
,
negativeStepCondition
,
booleanType
,
_semanticModel
,
limitValueReference
.
Syntax
,
limitValueReference
.
IsImplicit
)
End
If
End
If
End
Function
...
...
@@ -422,7 +434,8 @@ Namespace Microsoft.CodeAnalysis.Semantics
_semanticModel
,
syntax
,
type
:
=
Nothing
,
constantValue
:
=
Nothing
)
constantValue
:
=
Nothing
,
isImplicit
:
=
False
)
' Declaration is always explicit
End
Function
Private
Function
GetAddRemoveHandlerStatementExpression
(
statement
As
BoundAddRemoveHandlerStatement
)
As
IOperation
...
...
@@ -430,7 +443,7 @@ Namespace Microsoft.CodeAnalysis.Semantics
Dim
eventReference
=
If
(
eventAccess
Is
Nothing
,
Nothing
,
CreateBoundEventAccessOperation
(
eventAccess
))
Dim
adds
=
statement
.
Kind
=
BoundKind
.
AddHandlerStatement
Return
New
EventAssignmentExpression
(
eventReference
,
Create
(
statement
.
Handler
),
adds
:
=
adds
,
semanticModel
:
=
_semanticModel
,
syntax
:
=
statement
.
Syntax
,
type
:
=
Nothing
,
constantValue
:
=
Nothing
)
eventReference
,
Create
(
statement
.
Handler
),
adds
:
=
adds
,
semanticModel
:
=
_semanticModel
,
syntax
:
=
statement
.
Syntax
,
type
:
=
Nothing
,
constantValue
:
=
Nothing
,
isImplicit
:
=
statement
.
WasCompilerGenerated
)
End
Function
Private
Shared
Function
GetConversionKind
(
kind
As
VisualBasic
.
ConversionKind
)
As
Semantics
.
ConversionKind
...
...
src/Test/Utilities/Portable/Diagnostics/CouldHaveMoreSpecificTypeAnalyzer.cs
浏览文件 @
19bf7265
...
...
@@ -65,7 +65,8 @@ public sealed override void Initialize(AnalysisContext context)
SyntaxNode
syntax
=
increment
.
Syntax
;
ITypeSymbol
type
=
increment
.
Type
;
Optional
<
object
>
constantValue
=
new
Optional
<
object
>(
1
);
var
value
=
new
LiteralExpression
(
text
,
operationContext
.
Compilation
.
GetSemanticModel
(
syntax
.
SyntaxTree
),
syntax
,
type
,
constantValue
);
bool
isImplicit
=
increment
.
IsImplicit
;
var
value
=
new
LiteralExpression
(
text
,
operationContext
.
Compilation
.
GetSemanticModel
(
syntax
.
SyntaxTree
),
syntax
,
type
,
constantValue
,
isImplicit
);
AssignTo
(
increment
.
Target
,
localsSourceTypes
,
fieldsSourceTypes
,
value
);
}
...
...
src/Test/Utilities/Portable/Diagnostics/OperationTestAnalyzer.cs
浏览文件 @
19bf7265
...
...
@@ -286,8 +286,7 @@ private static ILiteralExpression CreateIncrementOneLiteralExpression(SemanticMo
SyntaxNode
syntax
=
increment
.
Syntax
;
ITypeSymbol
type
=
increment
.
Type
;
Optional
<
object
>
constantValue
=
new
Optional
<
object
>(
1
);
return
new
LiteralExpression
(
text
,
semanticModel
,
syntax
,
type
,
constantValue
);
return
new
LiteralExpression
(
text
,
semanticModel
,
syntax
,
type
,
constantValue
,
increment
.
IsImplicit
);
}
private
static
int
Abs
(
int
value
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录