Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
43add3e6
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,发现更多精彩内容 >>
提交
43add3e6
编写于
8月 31, 2015
作者:
N
Neal Gafter
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Integrate @semihokur's parser for the remainder of the pattern syntax forms.
上级
798a93bc
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
689 addition
and
63 deletion
+689
-63
src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs
src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs
+1
-1
src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml
src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml
+1
-1
src/Compilers/CSharp/Portable/FlowAnalysis/DataFlowPass.cs
src/Compilers/CSharp/Portable/FlowAnalysis/DataFlowPass.cs
+1
-1
src/Compilers/CSharp/Portable/FlowAnalysis/PreciseAbstractFlowPass.cs
...s/CSharp/Portable/FlowAnalysis/PreciseAbstractFlowPass.cs
+1
-1
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs
...Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs
+1
-1
src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
+464
-57
src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt
src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt
+119
-1
src/Compilers/CSharp/Portable/Syntax/Syntax.xml
src/Compilers/CSharp/Portable/Syntax/Syntax.xml
+85
-0
src/Compilers/CSharp/Portable/Syntax/SyntaxKind.cs
src/Compilers/CSharp/Portable/Syntax/SyntaxKind.cs
+8
-0
src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.AllInOne.cs
.../Semantic/Diagnostics/DiagnosticAnalyzerTests.AllInOne.cs
+4
-0
src/EditorFeatures/CSharpTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.cs
...DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.cs
+4
-0
未找到文件。
src/Compilers/CSharp/Portable/Binder/Binder_Patterns.cs
浏览文件 @
43add3e6
...
...
@@ -15,7 +15,7 @@ private BoundExpression BindIsPatternExpression(IsPatternExpressionSyntax node,
var
expression
=
BindExpression
(
node
.
Expression
,
diagnostics
);
var
hasErrors
=
IsOperandErrors
(
node
,
expression
,
diagnostics
);
var
pattern
=
BindPattern
(
node
.
Pattern
,
expression
,
expression
.
Type
,
hasErrors
,
diagnostics
);
return
new
BoundIsPattern
(
node
,
expression
,
pattern
,
GetSpecialType
(
SpecialType
.
System_Boolean
,
diagnostics
,
node
),
hasErrors
);
return
new
BoundIsPattern
Expression
(
node
,
expression
,
pattern
,
GetSpecialType
(
SpecialType
.
System_Boolean
,
diagnostics
,
node
),
hasErrors
);
}
private
BoundPattern
BindPattern
(
PatternSyntax
node
,
BoundExpression
operand
,
TypeSymbol
operandType
,
bool
hasErrors
,
DiagnosticBag
diagnostics
)
...
...
src/Compilers/CSharp/Portable/BoundTree/BoundNodes.xml
浏览文件 @
43add3e6
...
...
@@ -1344,7 +1344,7 @@
<Field
Name=
"IsVar"
Type=
"bool"
/>
</Node>
<Node
Name=
"BoundIsPattern"
Base=
"BoundExpression"
>
<Node
Name=
"BoundIsPattern
Expression
"
Base=
"BoundExpression"
>
<Field
Name=
"Expression"
Type=
"BoundExpression"
Null=
"disallow"
/>
<Field
Name=
"Pattern"
Type=
"BoundPattern"
Null=
"disallow"
/>
</Node>
...
...
src/Compilers/CSharp/Portable/FlowAnalysis/DataFlowPass.cs
浏览文件 @
43add3e6
...
...
@@ -1276,7 +1276,7 @@ protected override LocalState UnreachableState()
#
region
Visitors
public
override
BoundNode
VisitIsPattern
(
BoundIsPatter
n
node
)
public
override
BoundNode
VisitIsPattern
Expression
(
BoundIsPatternExpressio
n
node
)
{
VisitRvalue
(
node
.
Expression
);
var
stateWhenFalse
=
this
.
State
.
Clone
();
...
...
src/Compilers/CSharp/Portable/FlowAnalysis/PreciseAbstractFlowPass.cs
浏览文件 @
43add3e6
...
...
@@ -875,7 +875,7 @@ public override BoundNode VisitAttribute(BoundAttribute node)
return
null
;
}
public
override
BoundNode
VisitIsPattern
(
BoundIsPatter
n
node
)
public
override
BoundNode
VisitIsPattern
Expression
(
BoundIsPatternExpressio
n
node
)
{
VisitRvalue
(
node
.
Expression
);
return
null
;
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs
浏览文件 @
43add3e6
...
...
@@ -12,7 +12,7 @@ namespace Microsoft.CodeAnalysis.CSharp
{
internal
sealed
partial
class
LocalRewriter
{
public
override
BoundNode
VisitIsPattern
(
BoundIsPatter
n
node
)
public
override
BoundNode
VisitIsPattern
Expression
(
BoundIsPatternExpressio
n
node
)
{
var
expression
=
VisitExpression
(
node
.
Expression
);
var
result
=
TranslatePattern
(
expression
,
node
.
Pattern
);
...
...
src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
浏览文件 @
43add3e6
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt
浏览文件 @
43add3e6
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Portable/Syntax/Syntax.xml
浏览文件 @
43add3e6
...
...
@@ -1606,6 +1606,91 @@
<Kind
Name=
"IdentifierToken"
/>
</Field>
</Node>
<Node
Name=
"WildcardPatternSyntax"
Base=
"PatternSyntax"
>
<Kind
Name=
"WildcardPattern"
/>
<Field
Name=
"AsteriskToken"
Type=
"SyntaxToken"
>
<Kind
Name=
"AsteriskToken"
/>
</Field>
</Node>
<Node
Name=
"ConstantPatternSyntax"
Base=
"PatternSyntax"
>
<Kind
Name=
"ConstantPattern"
/>
<Field
Name=
"Expression"
Type=
"ExpressionSyntax"
>
<PropertyComment>
<summary>
ExpressionSyntax node representing the constant expression.
</summary>
</PropertyComment>
</Field>
</Node>
<Node
Name=
"RecursivePatternSyntax"
Base=
"PatternSyntax"
>
<Kind
Name=
"RecursivePattern"
/>
<Field
Name=
"Type"
Type=
"TypeSyntax"
/>
<Field
Name=
"PatternList"
Type=
"SubRecursivePatternListSyntax"
>
<PropertyComment>
<summary>
SubPatternListSyntax node representing the list of patterns in a recursive pattern.
</summary>
</PropertyComment>
</Field>
</Node>
<Node
Name=
"SubRecursivePatternListSyntax"
Base=
"CSharpSyntaxNode"
>
<Kind
Name=
"SubRecursivePatternList"
/>
<Field
Name=
"OpenParenToken"
Type=
"SyntaxToken"
>
<Kind
Name=
"OpenParenToken"
/>
<PropertyComment>
<summary>
SyntaxToken representing open parenthesis.
</summary>
</PropertyComment>
</Field>
<Field
Name=
"SubPatterns"
Type=
"SeparatedSyntaxList<SubRecursivePatternSyntax>"
>
<PropertyComment>
<summary>
SeparatedSyntaxList of SubPatternsSyntax representing the list of subpatterns.
</summary>
</PropertyComment>
</Field>
<Field
Name=
"CloseParenToken"
Type=
"SyntaxToken"
>
<Kind
Name=
"CloseParenToken"
/>
<PropertyComment>
<summary>
SyntaxToken representing close parenthesis.
</summary>
</PropertyComment>
</Field>
</Node>
<Node
Name=
"SubRecursivePatternSyntax"
Base=
"CSharpSyntaxNode"
>
<Kind
Name=
"SubRecursivePattern"
/>
<Field
Name=
"NameColon"
Type=
"NameColonSyntax"
Optional=
"true"
>
<PropertyComment>
<summary>
NameColonSyntax node representing the optional name arguments.
</summary>
</PropertyComment>
</Field>
<Field
Name=
"Pattern"
Type=
"PatternSyntax"
>
<PropertyComment>
<summary>
PatternSyntax node representing the pattern.
</summary>
</PropertyComment>
</Field>
</Node>
<Node
Name=
"PropertyPatternSyntax"
Base=
"PatternSyntax"
>
<Kind
Name=
"PropertyPattern"
/>
<Field
Name=
"Type"
Type=
"TypeSyntax"
/>
<Field
Name=
"PatternList"
Type=
"SubPropertyPatternListSyntax"
/>
</Node>
<Node
Name=
"SubPropertyPatternListSyntax"
Base=
"CSharpSyntaxNode"
>
<Kind
Name=
"SubPropertyPatternList"
/>
<Field
Name=
"OpenBraceToken"
Type=
"SyntaxToken"
>
<Kind
Name=
"OpenBraceToken"
/>
<PropertyComment>
<summary>
SyntaxToken representing open brace.
</summary>
</PropertyComment>
</Field>
<Field
Name=
"SubPatterns"
Type=
"SeparatedSyntaxList<SubPropertyPatternSyntax>"
/>
<Field
Name=
"CloseBraceToken"
Type=
"SyntaxToken"
>
<Kind
Name=
"CloseBraceToken"
/>
<PropertyComment>
<summary>
SyntaxToken representing close brace.
</summary>
</PropertyComment>
</Field>
</Node>
<Node
Name=
"SubPropertyPatternSyntax"
Base=
"CSharpSyntaxNode"
>
<Kind
Name=
"SubPropertyPattern"
/>
<Field
Name=
"Left"
Type=
"IdentifierNameSyntax"
/>
<Field
Name=
"IsKeyword"
Type=
"SyntaxToken"
>
<Kind
Name=
"IsKeyword"
/>
</Field>
<Field
Name=
"Pattern"
Type=
"PatternSyntax"
/>
</Node>
<AbstractNode
Name=
"InterpolatedStringContentSyntax"
Base=
"CSharpSyntaxNode"
/>
<Node
Name=
"InterpolatedStringTextSyntax"
Base=
"InterpolatedStringContentSyntax"
>
<Kind
Name=
"InterpolatedStringText"
/>
...
...
src/Compilers/CSharp/Portable/Syntax/SyntaxKind.cs
浏览文件 @
43add3e6
...
...
@@ -331,6 +331,14 @@ public enum SyntaxKind : ushort
// patterns (for pattern-matching)
DeclarationPattern
=
8658
,
WildcardPattern
=
8659
,
ConstantPattern
=
8660
,
RecursivePattern
=
8661
,
SubRecursivePattern
=
8662
,
SubRecursivePatternList
=
8663
,
PropertyPattern
=
8554
,
SubPropertyPattern
=
8555
,
SubPropertyPatternList
=
8556
,
// binary expressions
AddExpression
=
8668
,
...
...
src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.AllInOne.cs
浏览文件 @
43add3e6
...
...
@@ -29,6 +29,10 @@ public void DiagnosticAnalyzerAllInOne()
var
syntaxKindsPatterns
=
new
HashSet
<
SyntaxKind
>();
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
IsPatternExpression
);
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
DeclarationPattern
);
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
WildcardPattern
);
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
ConstantPattern
);
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
RecursivePattern
);
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
SubRecursivePattern
);
var
analyzer
=
new
CSharpTrackingDiagnosticAnalyzer
();
CreateCompilationWithMscorlib45
(
source
,
parseOptions
:
TestOptions
.
Regular
).
VerifyAnalyzerDiagnostics
(
new
[]
{
analyzer
});
...
...
src/EditorFeatures/CSharpTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.cs
浏览文件 @
43add3e6
...
...
@@ -32,6 +32,10 @@ public void DiagnosticAnalyzerDriverAllInOne()
var
syntaxKindsPatterns
=
new
HashSet
<
SyntaxKind
>();
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
IsPatternExpression
);
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
DeclarationPattern
);
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
WildcardPattern
);
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
ConstantPattern
);
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
RecursivePattern
);
syntaxKindsPatterns
.
Add
(
SyntaxKind
.
SubRecursivePattern
);
var
analyzer
=
new
CSharpTrackingDiagnosticAnalyzer
();
using
(
var
workspace
=
CSharpWorkspaceFactory
.
CreateWorkspaceFromFile
(
source
,
TestOptions
.
Regular
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录