Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
37e8a94a
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,发现更多精彩内容 >>
提交
37e8a94a
编写于
8月 30, 2016
作者:
T
Ty Overby
提交者:
GitHub
8月 30, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added a local-functionsless constructor for BoundBlock (#13408)
上级
48a14c14
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
18 addition
and
37 deletion
+18
-37
src/Compilers/CSharp/Portable/Binder/Binder.cs
src/Compilers/CSharp/Portable/Binder/Binder.cs
+1
-3
src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs
src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs
+1
-1
src/Compilers/CSharp/Portable/BoundTree/Constructors.cs
src/Compilers/CSharp/Portable/BoundTree/Constructors.cs
+7
-4
src/Compilers/CSharp/Portable/Compiler/MethodBodySynthesizer.cs
...mpilers/CSharp/Portable/Compiler/MethodBodySynthesizer.cs
+0
-3
src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs
src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs
+1
-1
src/Compilers/CSharp/Portable/FlowAnalysis/FlowAnalysisPass.cs
...ompilers/CSharp/Portable/FlowAnalysis/FlowAnalysisPass.cs
+1
-1
src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs
...CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs
+3
-3
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Block.cs
...rp/Portable/Lowering/LocalRewriter/LocalRewriter_Block.cs
+1
-1
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ForEachStatement.cs
.../Lowering/LocalRewriter/LocalRewriter_ForEachStatement.cs
+0
-7
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ForStatement.cs
...able/Lowering/LocalRewriter/LocalRewriter_ForStatement.cs
+1
-1
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_LockStatement.cs
...ble/Lowering/LocalRewriter/LocalRewriter_LockStatement.cs
+0
-2
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_SwitchStatement.cs
...e/Lowering/LocalRewriter/LocalRewriter_SwitchStatement.cs
+0
-1
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_UsingStatement.cs
...le/Lowering/LocalRewriter/LocalRewriter_UsingStatement.cs
+0
-3
src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
...ers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
+1
-1
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedEntryPointSymbol.cs
...rtable/Symbols/Synthesized/SynthesizedEntryPointSymbol.cs
+0
-2
src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEConstructorSymbol.cs
.../Source/ExpressionCompiler/Symbols/EEConstructorSymbol.cs
+0
-2
src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEMethodSymbol.cs
...Sharp/Source/ExpressionCompiler/Symbols/EEMethodSymbol.cs
+1
-1
未找到文件。
src/Compilers/CSharp/Portable/Binder/Binder.cs
浏览文件 @
37e8a94a
...
@@ -755,9 +755,7 @@ internal BoundStatement WrapWithVariablesIfAny(CSharpSyntaxNode scopeDesignator,
...
@@ -755,9 +755,7 @@ internal BoundStatement WrapWithVariablesIfAny(CSharpSyntaxNode scopeDesignator,
return
statement
;
return
statement
;
}
}
return
new
BoundBlock
(
statement
.
Syntax
,
locals
,
return
new
BoundBlock
(
statement
.
Syntax
,
locals
,
ImmutableArray
.
Create
(
statement
))
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
.
Create
(
statement
))
{
WasCompilerGenerated
=
true
};
{
WasCompilerGenerated
=
true
};
}
}
...
...
src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs
浏览文件 @
37e8a94a
...
@@ -3606,7 +3606,7 @@ internal BoundBlock CreateBlockFromExpression(CSharpSyntaxNode node, ImmutableAr
...
@@ -3606,7 +3606,7 @@ internal BoundBlock CreateBlockFromExpression(CSharpSyntaxNode node, ImmutableAr
}
}
// Need to attach the tree for when we generate sequence points.
// Need to attach the tree for when we generate sequence points.
return
new
BoundBlock
(
node
,
locals
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
.
Create
(
statement
))
{
WasCompilerGenerated
=
node
.
Kind
()
!=
SyntaxKind
.
ArrowExpressionClause
};
return
new
BoundBlock
(
node
,
locals
,
ImmutableArray
.
Create
(
statement
))
{
WasCompilerGenerated
=
node
.
Kind
()
!=
SyntaxKind
.
ArrowExpressionClause
};
}
}
/// <summary>
/// <summary>
...
...
src/Compilers/CSharp/Portable/BoundTree/Constructors.cs
浏览文件 @
37e8a94a
...
@@ -502,21 +502,24 @@ public BoundGotoStatement(SyntaxNode syntax, LabelSymbol label, bool hasErrors =
...
@@ -502,21 +502,24 @@ public BoundGotoStatement(SyntaxNode syntax, LabelSymbol label, bool hasErrors =
internal
partial
class
BoundBlock
internal
partial
class
BoundBlock
{
{
public
BoundBlock
(
SyntaxNode
syntax
,
ImmutableArray
<
LocalSymbol
>
locals
,
ImmutableArray
<
BoundStatement
>
statements
,
bool
hasErrors
=
false
):
this
(
syntax
,
locals
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
,
hasErrors
)
{
}
public
static
BoundBlock
SynthesizedNoLocals
(
SyntaxNode
syntax
,
BoundStatement
statement
)
public
static
BoundBlock
SynthesizedNoLocals
(
SyntaxNode
syntax
,
BoundStatement
statement
)
{
{
return
new
BoundBlock
(
syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
return
new
BoundBlock
(
syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
.
Create
(
statement
))
ImmutableArray
.
Create
(
statement
))
{
WasCompilerGenerated
=
true
};
{
WasCompilerGenerated
=
true
};
}
}
public
static
BoundBlock
SynthesizedNoLocals
(
SyntaxNode
syntax
,
ImmutableArray
<
BoundStatement
>
statements
)
public
static
BoundBlock
SynthesizedNoLocals
(
SyntaxNode
syntax
,
ImmutableArray
<
BoundStatement
>
statements
)
{
{
return
new
BoundBlock
(
syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
)
{
WasCompilerGenerated
=
true
};
return
new
BoundBlock
(
syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
statements
)
{
WasCompilerGenerated
=
true
};
}
}
public
static
BoundBlock
SynthesizedNoLocals
(
SyntaxNode
syntax
,
params
BoundStatement
[]
statements
)
public
static
BoundBlock
SynthesizedNoLocals
(
SyntaxNode
syntax
,
params
BoundStatement
[]
statements
)
{
{
return
new
BoundBlock
(
syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
.
AsImmutableOrNull
())
{
WasCompilerGenerated
=
true
};
return
new
BoundBlock
(
syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
statements
.
AsImmutableOrNull
())
{
WasCompilerGenerated
=
true
};
}
}
}
}
...
...
src/Compilers/CSharp/Portable/Compiler/MethodBodySynthesizer.cs
浏览文件 @
37e8a94a
...
@@ -498,7 +498,6 @@ internal static BoundBlock ConstructFieldLikeEventAccessorBody_Regular(SourceEve
...
@@ -498,7 +498,6 @@ internal static BoundBlock ConstructFieldLikeEventAccessorBody_Regular(SourceEve
return
new
BoundBlock
(
syntax
,
return
new
BoundBlock
(
syntax
,
locals
:
tmps
.
AsImmutable
(),
locals
:
tmps
.
AsImmutable
(),
localFunctions
:
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
tmp0Init
,
tmp0Init
,
loopStart
,
loopStart
,
...
@@ -542,7 +541,6 @@ internal static BoundBlock ConstructDestructorBody(MethodSymbol method, BoundBlo
...
@@ -542,7 +541,6 @@ internal static BoundBlock ConstructDestructorBody(MethodSymbol method, BoundBlo
return
new
BoundBlock
(
return
new
BoundBlock
(
syntax
,
syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
.
Create
<
BoundStatement
>(
ImmutableArray
.
Create
<
BoundStatement
>(
new
BoundTryStatement
(
new
BoundTryStatement
(
syntax
,
syntax
,
...
@@ -551,7 +549,6 @@ internal static BoundBlock ConstructDestructorBody(MethodSymbol method, BoundBlo
...
@@ -551,7 +549,6 @@ internal static BoundBlock ConstructDestructorBody(MethodSymbol method, BoundBlo
new
BoundBlock
(
new
BoundBlock
(
syntax
,
syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
.
Create
<
BoundStatement
>(
ImmutableArray
.
Create
<
BoundStatement
>(
baseFinalizeCall
)
baseFinalizeCall
)
)
)
...
...
src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs
浏览文件 @
37e8a94a
...
@@ -854,7 +854,7 @@ public override object VisitField(FieldSymbol symbol, TypeCompilationState argum
...
@@ -854,7 +854,7 @@ public override object VisitField(FieldSymbol symbol, TypeCompilationState argum
if
(
methodSymbol
.
IsScriptConstructor
)
if
(
methodSymbol
.
IsScriptConstructor
)
{
{
body
=
new
BoundBlock
(
methodSymbol
.
GetNonNullSyntaxNode
(),
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
<
BoundStatement
>.
Empty
)
{
WasCompilerGenerated
=
true
};
body
=
new
BoundBlock
(
methodSymbol
.
GetNonNullSyntaxNode
(),
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
BoundStatement
>.
Empty
)
{
WasCompilerGenerated
=
true
};
}
}
else
if
(
methodSymbol
.
IsScriptInitializer
)
else
if
(
methodSymbol
.
IsScriptInitializer
)
{
{
...
...
src/Compilers/CSharp/Portable/FlowAnalysis/FlowAnalysisPass.cs
浏览文件 @
37e8a94a
...
@@ -58,7 +58,7 @@ internal class FlowAnalysisPass
...
@@ -58,7 +58,7 @@ internal class FlowAnalysisPass
var
trailingExpression
=
new
BoundDefaultOperator
(
method
.
GetNonNullSyntaxNode
(),
submissionResultType
);
var
trailingExpression
=
new
BoundDefaultOperator
(
method
.
GetNonNullSyntaxNode
(),
submissionResultType
);
var
newStatements
=
block
.
Statements
.
Add
(
new
BoundReturnStatement
(
trailingExpression
.
Syntax
,
RefKind
.
None
,
trailingExpression
));
var
newStatements
=
block
.
Statements
.
Add
(
new
BoundReturnStatement
(
trailingExpression
.
Syntax
,
RefKind
.
None
,
trailingExpression
));
block
=
new
BoundBlock
(
block
.
Syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
newStatements
)
{
WasCompilerGenerated
=
true
};
block
=
new
BoundBlock
(
block
.
Syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
newStatements
)
{
WasCompilerGenerated
=
true
};
#if DEBUG
#if DEBUG
// It should not be necessary to repeat analysis after adding this node, because adding a trailing
// It should not be necessary to repeat analysis after adding this node, because adding a trailing
// return in cases where one was missing should never produce different Diagnostics.
// return in cases where one was missing should never produce different Diagnostics.
...
...
src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs
浏览文件 @
37e8a94a
...
@@ -267,7 +267,7 @@ private BoundStatement AddStatementsIfNeeded(BoundStatement body)
...
@@ -267,7 +267,7 @@ private BoundStatement AddStatementsIfNeeded(BoundStatement body)
if
(
_addedLocals
!=
null
)
if
(
_addedLocals
!=
null
)
{
{
_addedStatements
.
Add
(
body
);
_addedStatements
.
Add
(
body
);
body
=
new
BoundBlock
(
body
.
Syntax
,
_addedLocals
.
ToImmutableAndFree
(),
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
_addedStatements
.
ToImmutableAndFree
())
{
WasCompilerGenerated
=
true
};
body
=
new
BoundBlock
(
body
.
Syntax
,
_addedLocals
.
ToImmutableAndFree
(),
_addedStatements
.
ToImmutableAndFree
())
{
WasCompilerGenerated
=
true
};
_addedLocals
=
null
;
_addedLocals
=
null
;
_addedStatements
=
null
;
_addedStatements
=
null
;
}
}
...
@@ -1046,7 +1046,7 @@ public override BoundNode VisitStatementList(BoundStatementList node)
...
@@ -1046,7 +1046,7 @@ public override BoundNode VisitStatementList(BoundStatementList node)
newStatements
.
Add
((
BoundStatement
)
this
.
Visit
(
s
));
newStatements
.
Add
((
BoundStatement
)
this
.
Visit
(
s
));
}
}
return
new
BoundBlock
(
node
.
Syntax
,
newLocals
.
ToImmutableAndFree
(),
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
newStatements
.
ToImmutableAndFree
(),
node
.
HasErrors
);
return
new
BoundBlock
(
node
.
Syntax
,
newLocals
.
ToImmutableAndFree
(),
newStatements
.
ToImmutableAndFree
(),
node
.
HasErrors
);
});
});
}
}
else
else
...
@@ -1067,7 +1067,7 @@ public override BoundNode VisitSwitchStatement(BoundSwitchStatement node)
...
@@ -1067,7 +1067,7 @@ public override BoundNode VisitSwitchStatement(BoundSwitchStatement node)
InsertAndFreePrologue
(
newStatements
,
prologue
);
InsertAndFreePrologue
(
newStatements
,
prologue
);
newStatements
.
Add
((
BoundStatement
)
base
.
VisitSwitchStatement
(
node
));
newStatements
.
Add
((
BoundStatement
)
base
.
VisitSwitchStatement
(
node
));
return
new
BoundBlock
(
node
.
Syntax
,
newLocals
.
ToImmutableAndFree
(),
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
newStatements
.
ToImmutableAndFree
(),
node
.
HasErrors
);
return
new
BoundBlock
(
node
.
Syntax
,
newLocals
.
ToImmutableAndFree
(),
newStatements
.
ToImmutableAndFree
(),
node
.
HasErrors
);
});
});
}
}
else
else
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Block.cs
浏览文件 @
37e8a94a
...
@@ -44,7 +44,7 @@ public override BoundNode VisitBlock(BoundBlock node)
...
@@ -44,7 +44,7 @@ public override BoundNode VisitBlock(BoundBlock node)
public
override
BoundNode
VisitNoOpStatement
(
BoundNoOpStatement
node
)
public
override
BoundNode
VisitNoOpStatement
(
BoundNoOpStatement
node
)
{
{
return
(
node
.
WasCompilerGenerated
||
!
this
.
Instrument
)
return
(
node
.
WasCompilerGenerated
||
!
this
.
Instrument
)
?
new
BoundBlock
(
node
.
Syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
<
BoundStatement
>.
Empty
)
?
new
BoundBlock
(
node
.
Syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
ImmutableArray
<
BoundStatement
>.
Empty
)
:
_instrumenter
.
InstrumentNoOpStatement
(
node
,
node
);
:
_instrumenter
.
InstrumentNoOpStatement
(
node
,
node
);
}
}
}
}
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ForEachStatement.cs
浏览文件 @
37e8a94a
...
@@ -209,7 +209,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
...
@@ -209,7 +209,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
finallyBlockOpt
=
new
BoundBlock
(
forEachSyntax
,
finallyBlockOpt
=
new
BoundBlock
(
forEachSyntax
,
locals
:
ImmutableArray
<
LocalSymbol
>.
Empty
,
locals
:
ImmutableArray
<
LocalSymbol
>.
Empty
,
localFunctions
:
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
disposeStmt
));
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
disposeStmt
));
}
}
else
else
...
@@ -261,7 +260,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
...
@@ -261,7 +260,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
// if (d != null) d.Dispose();
// if (d != null) d.Dispose();
finallyBlockOpt
=
new
BoundBlock
(
forEachSyntax
,
finallyBlockOpt
=
new
BoundBlock
(
forEachSyntax
,
locals
:
ImmutableArray
.
Create
<
LocalSymbol
>(
disposableVar
),
locals
:
ImmutableArray
.
Create
<
LocalSymbol
>(
disposableVar
),
localFunctions
:
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
disposableVarDecl
,
ifStmt
));
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
disposableVarDecl
,
ifStmt
));
}
}
...
@@ -277,7 +275,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
...
@@ -277,7 +275,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
BoundStatement
tryFinally
=
new
BoundTryStatement
(
forEachSyntax
,
BoundStatement
tryFinally
=
new
BoundTryStatement
(
forEachSyntax
,
tryBlock
:
new
BoundBlock
(
forEachSyntax
,
tryBlock
:
new
BoundBlock
(
forEachSyntax
,
locals
:
ImmutableArray
<
LocalSymbol
>.
Empty
,
locals
:
ImmutableArray
<
LocalSymbol
>.
Empty
,
localFunctions
:
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
whileLoop
)),
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
whileLoop
)),
catchBlocks
:
ImmutableArray
<
BoundCatchBlock
>.
Empty
,
catchBlocks
:
ImmutableArray
<
BoundCatchBlock
>.
Empty
,
finallyBlockOpt
:
finallyBlockOpt
);
finallyBlockOpt
:
finallyBlockOpt
);
...
@@ -288,7 +285,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
...
@@ -288,7 +285,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
result
=
new
BoundBlock
(
result
=
new
BoundBlock
(
syntax
:
forEachSyntax
,
syntax
:
forEachSyntax
,
locals
:
ImmutableArray
.
Create
(
enumeratorVar
),
locals
:
ImmutableArray
.
Create
(
enumeratorVar
),
localFunctions
:
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
enumeratorVarDecl
,
tryFinally
));
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
enumeratorVarDecl
,
tryFinally
));
}
}
else
else
...
@@ -301,7 +297,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
...
@@ -301,7 +297,6 @@ private BoundStatement RewriteEnumeratorForEachStatement(BoundForEachStatement n
result
=
new
BoundBlock
(
result
=
new
BoundBlock
(
syntax
:
forEachSyntax
,
syntax
:
forEachSyntax
,
locals
:
ImmutableArray
.
Create
(
enumeratorVar
),
locals
:
ImmutableArray
.
Create
(
enumeratorVar
),
localFunctions
:
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
enumeratorVarDecl
,
whileLoop
));
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
enumeratorVarDecl
,
whileLoop
));
}
}
...
@@ -549,7 +544,6 @@ private BoundStatement RewriteStringForEachStatement(BoundForEachStatement node)
...
@@ -549,7 +544,6 @@ private BoundStatement RewriteStringForEachStatement(BoundForEachStatement node)
return
new
BoundBlock
(
return
new
BoundBlock
(
forEachSyntax
,
forEachSyntax
,
locals
:
iterationVariables
,
locals
:
iterationVariables
,
localFunctions
:
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
:
ImmutableArray
.
Create
(
iteratorVariableInitialization
,
rewrittenBody
));
statements
:
ImmutableArray
.
Create
(
iteratorVariableInitialization
,
rewrittenBody
));
}
}
...
@@ -865,7 +859,6 @@ private BoundStatement RewriteMultiDimensionalArrayForEachStatement(BoundForEach
...
@@ -865,7 +859,6 @@ private BoundStatement RewriteMultiDimensionalArrayForEachStatement(BoundForEach
BoundStatement
result
=
new
BoundBlock
(
BoundStatement
result
=
new
BoundBlock
(
forEachSyntax
,
forEachSyntax
,
ImmutableArray
.
Create
(
arrayVar
).
Concat
(
upperVar
.
AsImmutableOrNull
()),
ImmutableArray
.
Create
(
arrayVar
).
Concat
(
upperVar
.
AsImmutableOrNull
()),
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
.
Create
(
arrayVarDecl
).
Concat
(
upperVarDecl
.
AsImmutableOrNull
()).
Add
(
forLoop
));
ImmutableArray
.
Create
(
arrayVarDecl
).
Concat
(
upperVarDecl
.
AsImmutableOrNull
()).
Add
(
forLoop
));
InstrumentForEachStatement
(
node
,
ref
result
);
InstrumentForEachStatement
(
node
,
ref
result
);
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ForStatement.cs
浏览文件 @
37e8a94a
...
@@ -168,7 +168,7 @@ public override BoundNode VisitForStatement(BoundForStatement node)
...
@@ -168,7 +168,7 @@ public override BoundNode VisitForStatement(BoundForStatement node)
statementBuilder
.
Add
(
new
BoundLabelStatement
(
syntax
,
breakLabel
));
statementBuilder
.
Add
(
new
BoundLabelStatement
(
syntax
,
breakLabel
));
var
statements
=
statementBuilder
.
ToImmutableAndFree
();
var
statements
=
statementBuilder
.
ToImmutableAndFree
();
return
new
BoundBlock
(
syntax
,
outerLocals
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
,
hasErrors
);
return
new
BoundBlock
(
syntax
,
outerLocals
,
statements
,
hasErrors
);
}
}
}
}
}
}
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_LockStatement.cs
浏览文件 @
37e8a94a
...
@@ -120,7 +120,6 @@ public override BoundNode VisitLockStatement(BoundLockStatement node)
...
@@ -120,7 +120,6 @@ public override BoundNode VisitLockStatement(BoundLockStatement node)
return
new
BoundBlock
(
return
new
BoundBlock
(
lockSyntax
,
lockSyntax
,
ImmutableArray
.
Create
(
boundLockTemp
.
LocalSymbol
,
boundLockTakenTemp
.
LocalSymbol
),
ImmutableArray
.
Create
(
boundLockTemp
.
LocalSymbol
,
boundLockTakenTemp
.
LocalSymbol
),
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
.
Create
(
ImmutableArray
.
Create
(
InstrumentLockTargetCapture
(
node
,
boundLockTempInit
),
InstrumentLockTargetCapture
(
node
,
boundLockTempInit
),
boundLockTakenTempInit
,
boundLockTakenTempInit
,
...
@@ -171,7 +170,6 @@ public override BoundNode VisitLockStatement(BoundLockStatement node)
...
@@ -171,7 +170,6 @@ public override BoundNode VisitLockStatement(BoundLockStatement node)
return
new
BoundBlock
(
return
new
BoundBlock
(
lockSyntax
,
lockSyntax
,
ImmutableArray
.
Create
(
boundLockTemp
.
LocalSymbol
),
ImmutableArray
.
Create
(
boundLockTemp
.
LocalSymbol
),
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
.
Create
(
ImmutableArray
.
Create
(
InstrumentLockTargetCapture
(
node
,
boundLockTempInit
),
InstrumentLockTargetCapture
(
node
,
boundLockTempInit
),
enterCall
,
enterCall
,
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_SwitchStatement.cs
浏览文件 @
37e8a94a
...
@@ -184,7 +184,6 @@ public override BoundNode VisitSwitchStatement(BoundSwitchStatement node)
...
@@ -184,7 +184,6 @@ public override BoundNode VisitSwitchStatement(BoundSwitchStatement node)
return
new
BoundBlock
(
return
new
BoundBlock
(
syntax
,
syntax
,
locals
:
(
object
)
tempLocal
==
null
?
ImmutableArray
<
LocalSymbol
>.
Empty
:
ImmutableArray
.
Create
<
LocalSymbol
>(
tempLocal
),
locals
:
(
object
)
tempLocal
==
null
?
ImmutableArray
<
LocalSymbol
>.
Empty
:
ImmutableArray
.
Create
<
LocalSymbol
>(
tempLocal
),
localFunctions
:
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
:
statementBuilder
.
ToImmutableAndFree
());
statements
:
statementBuilder
.
ToImmutableAndFree
());
}
}
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_UsingStatement.cs
浏览文件 @
37e8a94a
...
@@ -56,7 +56,6 @@ public override BoundNode VisitUsingStatement(BoundUsingStatement node)
...
@@ -56,7 +56,6 @@ public override BoundNode VisitUsingStatement(BoundUsingStatement node)
return
new
BoundBlock
(
return
new
BoundBlock
(
usingSyntax
,
usingSyntax
,
node
.
Locals
,
node
.
Locals
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
.
Create
<
BoundStatement
>(
result
));
ImmutableArray
.
Create
<
BoundStatement
>(
result
));
}
}
}
}
...
@@ -142,7 +141,6 @@ private BoundBlock RewriteExpressionUsingStatement(BoundUsingStatement node, Bou
...
@@ -142,7 +141,6 @@ private BoundBlock RewriteExpressionUsingStatement(BoundUsingStatement node, Bou
return
new
BoundBlock
(
return
new
BoundBlock
(
syntax
:
usingSyntax
,
syntax
:
usingSyntax
,
locals
:
node
.
Locals
.
Add
(
boundTemp
.
LocalSymbol
),
locals
:
node
.
Locals
.
Add
(
boundTemp
.
LocalSymbol
),
localFunctions
:
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
expressionStatement
,
tryFinally
));
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
expressionStatement
,
tryFinally
));
}
}
...
@@ -192,7 +190,6 @@ private BoundBlock RewriteDeclarationUsingStatement(SyntaxNode usingSyntax, Boun
...
@@ -192,7 +190,6 @@ private BoundBlock RewriteDeclarationUsingStatement(SyntaxNode usingSyntax, Boun
return
new
BoundBlock
(
return
new
BoundBlock
(
syntax
:
usingSyntax
,
syntax
:
usingSyntax
,
locals
:
ImmutableArray
.
Create
<
LocalSymbol
>(
boundTemp
.
LocalSymbol
),
//localSymbol will be declared by an enclosing block
locals
:
ImmutableArray
.
Create
<
LocalSymbol
>(
boundTemp
.
LocalSymbol
),
//localSymbol will be declared by an enclosing block
localFunctions
:
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
statements
:
ImmutableArray
.
Create
<
BoundStatement
>(
rewrittenDeclaration
,
rewrittenDeclaration
,
new
BoundExpressionStatement
(
declarationSyntax
,
tempAssignment
),
new
BoundExpressionStatement
(
declarationSyntax
,
tempAssignment
),
...
...
src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
浏览文件 @
37e8a94a
...
@@ -408,7 +408,7 @@ public BoundBlock Block(ImmutableArray<LocalSymbol> locals, params BoundStatemen
...
@@ -408,7 +408,7 @@ public BoundBlock Block(ImmutableArray<LocalSymbol> locals, params BoundStatemen
public
BoundBlock
Block
(
ImmutableArray
<
LocalSymbol
>
locals
,
ImmutableArray
<
BoundStatement
>
statements
)
public
BoundBlock
Block
(
ImmutableArray
<
LocalSymbol
>
locals
,
ImmutableArray
<
BoundStatement
>
statements
)
{
{
return
new
BoundBlock
(
Syntax
,
locals
,
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statements
)
{
WasCompilerGenerated
=
true
};
return
new
BoundBlock
(
Syntax
,
locals
,
statements
)
{
WasCompilerGenerated
=
true
};
}
}
public
BoundBlock
Block
(
ImmutableArray
<
LocalSymbol
>
locals
,
ImmutableArray
<
LocalFunctionSymbol
>
localFunctions
,
params
BoundStatement
[]
statements
)
public
BoundBlock
Block
(
ImmutableArray
<
LocalSymbol
>
locals
,
ImmutableArray
<
LocalFunctionSymbol
>
localFunctions
,
params
BoundStatement
[]
statements
)
...
...
src/Compilers/CSharp/Portable/Symbols/Synthesized/SynthesizedEntryPointSymbol.cs
浏览文件 @
37e8a94a
...
@@ -377,7 +377,6 @@ internal override BoundBlock CreateBody()
...
@@ -377,7 +377,6 @@ internal override BoundBlock CreateBody()
return
new
BoundBlock
(
syntax
,
return
new
BoundBlock
(
syntax
,
ImmutableArray
.
Create
<
LocalSymbol
>(
scriptLocal
.
LocalSymbol
),
ImmutableArray
.
Create
<
LocalSymbol
>(
scriptLocal
.
LocalSymbol
),
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
.
Create
<
BoundStatement
>(
ImmutableArray
.
Create
<
BoundStatement
>(
// var script = new Script();
// var script = new Script();
new
BoundExpressionStatement
(
new
BoundExpressionStatement
(
...
@@ -497,7 +496,6 @@ internal override BoundBlock CreateBody()
...
@@ -497,7 +496,6 @@ internal override BoundBlock CreateBody()
return
new
BoundBlock
(
syntax
,
return
new
BoundBlock
(
syntax
,
ImmutableArray
.
Create
<
LocalSymbol
>(
submissionLocal
.
LocalSymbol
),
ImmutableArray
.
Create
<
LocalSymbol
>(
submissionLocal
.
LocalSymbol
),
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
ImmutableArray
.
Create
<
BoundStatement
>(
submissionAssignment
,
returnStatement
))
ImmutableArray
.
Create
<
BoundStatement
>(
submissionAssignment
,
returnStatement
))
{
WasCompilerGenerated
=
true
};
{
WasCompilerGenerated
=
true
};
}
}
...
...
src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEConstructorSymbol.cs
浏览文件 @
37e8a94a
...
@@ -18,7 +18,6 @@ internal EEConstructorSymbol(NamedTypeSymbol containingType)
...
@@ -18,7 +18,6 @@ internal EEConstructorSymbol(NamedTypeSymbol containingType)
internal
override
void
GenerateMethodBody
(
TypeCompilationState
compilationState
,
DiagnosticBag
diagnostics
)
internal
override
void
GenerateMethodBody
(
TypeCompilationState
compilationState
,
DiagnosticBag
diagnostics
)
{
{
var
noLocals
=
ImmutableArray
<
LocalSymbol
>.
Empty
;
var
noLocals
=
ImmutableArray
<
LocalSymbol
>.
Empty
;
var
noLocalFunctions
=
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
;
var
initializerInvocation
=
MethodCompiler
.
BindConstructorInitializer
(
this
,
diagnostics
,
compilationState
.
Compilation
);
var
initializerInvocation
=
MethodCompiler
.
BindConstructorInitializer
(
this
,
diagnostics
,
compilationState
.
Compilation
);
var
syntax
=
initializerInvocation
.
Syntax
;
var
syntax
=
initializerInvocation
.
Syntax
;
...
@@ -26,7 +25,6 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState,
...
@@ -26,7 +25,6 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState,
new
BoundBlock
(
new
BoundBlock
(
syntax
,
syntax
,
noLocals
,
noLocals
,
noLocalFunctions
,
ImmutableArray
.
Create
<
BoundStatement
>(
ImmutableArray
.
Create
<
BoundStatement
>(
new
BoundExpressionStatement
(
syntax
,
initializerInvocation
),
new
BoundExpressionStatement
(
syntax
,
initializerInvocation
),
new
BoundReturnStatement
(
syntax
,
RefKind
.
None
,
null
))));
new
BoundReturnStatement
(
syntax
,
RefKind
.
None
,
null
))));
...
...
src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/EEMethodSymbol.cs
浏览文件 @
37e8a94a
...
@@ -492,7 +492,7 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState,
...
@@ -492,7 +492,7 @@ internal override void GenerateMethodBody(TypeCompilationState compilationState,
}
}
localsSet
.
Free
();
localsSet
.
Free
();
body
=
new
BoundBlock
(
syntax
,
localsBuilder
.
ToImmutableAndFree
(),
ImmutableArray
<
LocalFunctionSymbol
>.
Empty
,
statementsBuilder
.
ToImmutableAndFree
())
{
WasCompilerGenerated
=
true
};
body
=
new
BoundBlock
(
syntax
,
localsBuilder
.
ToImmutableAndFree
(),
statementsBuilder
.
ToImmutableAndFree
())
{
WasCompilerGenerated
=
true
};
Debug
.
Assert
(!
diagnostics
.
HasAnyErrors
());
Debug
.
Assert
(!
diagnostics
.
HasAnyErrors
());
Debug
.
Assert
(!
body
.
HasErrors
);
Debug
.
Assert
(!
body
.
HasErrors
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录