Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
8ea9ab66
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,发现更多精彩内容 >>
提交
8ea9ab66
编写于
7月 17, 2015
作者:
C
Charles Stoner
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3991 from cston/Await
Incorporate PR feedback from #3813
上级
da8b0dbd
6b647276
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
65 addition
and
63 deletion
+65
-63
src/Compilers/CSharp/Portable/Binder/Binder_Initializers.cs
src/Compilers/CSharp/Portable/Binder/Binder_Initializers.cs
+8
-3
src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs
src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs
+27
-27
src/Compilers/VisualBasic/Portable/Binding/Binder_Initializers.vb
...ilers/VisualBasic/Portable/Binding/Binder_Initializers.vb
+9
-4
src/Compilers/VisualBasic/Portable/Compilation/MethodCompiler.vb
...pilers/VisualBasic/Portable/Compilation/MethodCompiler.vb
+21
-22
src/Scripting/Test/Session.cs
src/Scripting/Test/Session.cs
+0
-7
未找到文件。
src/Compilers/CSharp/Portable/Binder/Binder_Initializers.cs
浏览文件 @
8ea9ab66
...
...
@@ -187,7 +187,7 @@ internal struct ProcessedFieldInitializers
else
{
var
collisionDetector
=
new
LocalScopeBinder
(
parentBinder
);
boundInitializer
=
BindGlobalStatement
(
collisionDetector
,
(
StatementSyntax
)
initializerNode
,
diagnostics
,
boundInitializer
=
BindGlobalStatement
(
collisionDetector
,
scriptInitializer
,
(
StatementSyntax
)
initializerNode
,
diagnostics
,
isLast
:
i
==
initializers
.
Length
-
1
&&
j
==
siblingInitializers
.
Length
-
1
);
}
...
...
@@ -196,7 +196,12 @@ internal struct ProcessedFieldInitializers
}
}
private
static
BoundInitializer
BindGlobalStatement
(
Binder
binder
,
StatementSyntax
statementNode
,
DiagnosticBag
diagnostics
,
bool
isLast
)
private
static
BoundInitializer
BindGlobalStatement
(
Binder
binder
,
SynthesizedInteractiveInitializerMethod
scriptInitializer
,
StatementSyntax
statementNode
,
DiagnosticBag
diagnostics
,
bool
isLast
)
{
BoundStatement
boundStatement
=
binder
.
BindStatement
(
statementNode
,
diagnostics
);
...
...
@@ -207,7 +212,7 @@ private static BoundInitializer BindGlobalStatement(Binder binder, StatementSynt
var
expression
=
((
BoundExpressionStatement
)
boundStatement
).
Expression
;
if
((
object
)
expression
.
Type
==
null
||
expression
.
Type
.
SpecialType
!=
SpecialType
.
System_Void
)
{
var
submissionResultType
=
binder
.
Compilation
.
GetSubmissionInitializer
()
.
ResultType
;
var
submissionResultType
=
scriptInitializer
.
ResultType
;
expression
=
binder
.
GenerateConversionForAssignment
(
submissionResultType
,
expression
,
diagnostics
);
boundStatement
=
new
BoundExpressionStatement
(
boundStatement
.
Syntax
,
expression
,
expression
.
HasErrors
);
}
...
...
src/Compilers/CSharp/Portable/Compiler/MethodCompiler.cs
浏览文件 @
8ea9ab66
...
...
@@ -194,33 +194,33 @@ private static MethodSymbol GetEntryPoint(CSharpCompilation compilation, PEModul
Debug
.
Assert
(!
entryPointAndDiagnostics
.
Diagnostics
.
IsDefault
);
diagnostics
.
AddRange
(
entryPointAndDiagnostics
.
Diagnostics
);
var
entryPoint
=
entryPointAndDiagnostics
.
MethodSymbol
as
SynthesizedEntryPointSymbol
;
if
((
object
)
entryPoint
!=
null
)
{
if
(
moduleBeingBuilt
!=
null
&&
!
hasDeclarationErrors
&&
!
diagnostics
.
HasAnyErrors
())
{
var
body
=
entryPoint
.
CreateBody
();
const
int
methodOrdinal
=
-
1
;
var
emittedBody
=
GenerateMethodBody
(
moduleBeingBuilt
,
entryPoin
t
,
methodOrdinal
,
body
,
ImmutableArray
<
LambdaDebugInfo
>.
Empt
y
,
ImmutableArray
<
Closure
DebugInfo
>.
Empty
,
stateMachineTypeOpt
:
null
,
variableSlotAllocator
Opt
:
null
,
diagnostics
:
diagnostics
,
debugDocumentProvider
:
null
,
importChainOpt
:
null
,
emittingPdb
:
false
);
moduleBeingBuilt
.
SetMethodBody
(
entryPoint
,
emittedBody
);
}
}
Debug
.
Assert
((
object
)
entryPoint
AndDiagnostics
.
MethodSymbol
!=
null
||
entryPointAndDiagnostics
.
Diagnostics
.
HasAnyErrors
()
||
!
compilation
.
Options
.
Errors
.
IsDefaultOrEmpty
);
return
entryPoint
AndDiagnostics
.
MethodSymbol
;
var
entryPoint
=
entryPointAndDiagnostics
.
MethodSymbol
;
var
synthesizedEntryPoint
=
entryPoint
as
SynthesizedEntryPointSymbol
;
if
(((
object
)
synthesizedEntryPoint
!=
null
)
&&
(
moduleBeingBuilt
!=
null
)
&&
!
hasDeclarationErrors
&&
!
diagnostics
.
HasAnyErrors
())
{
var
body
=
synthesizedEntryPoint
.
CreateBody
();
const
int
methodOrdinal
=
-
1
;
var
emittedBody
=
GenerateMethodBody
(
moduleBeingBuil
t
,
synthesizedEntryPoint
,
methodOrdinal
,
bod
y
,
ImmutableArray
<
Lambda
DebugInfo
>.
Empty
,
ImmutableArray
<
ClosureDebugInfo
>.
Empty
,
stateMachineType
Opt
:
null
,
variableSlotAllocatorOpt
:
null
,
diagnostics
:
diagnostics
,
debugDocumentProvider
:
null
,
importChainOpt
:
null
,
emittingPdb
:
false
);
moduleBeingBuilt
.
SetMethodBody
(
synthesizedEntryPoint
,
emittedBody
);
}
Debug
.
Assert
((
object
)
entryPoint
!=
null
||
entryPointAndDiagnostics
.
Diagnostics
.
HasAnyErrors
()
||
!
compilation
.
Options
.
Errors
.
IsDefaultOrEmpty
);
return
entryPoint
;
}
private
void
WaitForWorkers
()
...
...
src/Compilers/VisualBasic/Portable/Binding/Binder_Initializers.vb
浏览文件 @
8ea9ab66
...
...
@@ -76,7 +76,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Friend
Shared
Sub
BindFieldAndPropertyInitializers
(
symbol
As
SourceMemberContainerTypeSymbol
,
initializers
As
ImmutableArray
(
Of
ImmutableArray
(
Of
FieldOrPropertyInitializer
)),
scriptInitializerOpt
As
MethodSymbol
,
scriptInitializerOpt
As
SynthesizedInteractiveInitializerMethod
,
ByRef
processedFieldInitializers
As
ProcessedFieldOrPropertyInitializers
,
diagnostics
As
DiagnosticBag
)
...
...
@@ -122,7 +122,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
If
initializer
.
FieldsOrProperty
.
IsDefault
Then
' use the binder of the Script class for global statements
Dim
isLast
=
(
i
=
initializers
.
Length
-
1
AndAlso
j
=
siblingInitializers
.
Length
-
1
)
boundInitializers
.
Add
(
parentBinder
.
BindGlobalStatement
(
DirectCast
(
initializerNode
,
StatementSyntax
),
diagnostics
,
isLast
))
boundInitializers
.
Add
(
parentBinder
.
BindGlobalStatement
(
scriptInitializerOpt
,
DirectCast
(
initializerNode
,
StatementSyntax
),
diagnostics
,
isLast
))
Continue
For
End
If
...
...
@@ -195,14 +195,19 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
boundInitializers
.
ToImmutableAndFree
())
End
Sub
Private
Function
BindGlobalStatement
(
statementNode
As
StatementSyntax
,
diagnostics
As
DiagnosticBag
,
isLast
As
Boolean
)
As
BoundInitializer
Private
Function
BindGlobalStatement
(
scriptInitializerOpt
As
SynthesizedInteractiveInitializerMethod
,
statementNode
As
StatementSyntax
,
diagnostics
As
DiagnosticBag
,
isLast
As
Boolean
)
As
BoundInitializer
Dim
boundStatement
As
BoundStatement
=
Me
.
BindStatement
(
statementNode
,
diagnostics
)
If
Me
.
Compilation
.
IsSubmission
AndAlso
isLast
AndAlso
boundStatement
.
Kind
=
BoundKind
.
ExpressionStatement
AndAlso
Not
boundStatement
.
HasErrors
Then
' insert an implicit conversion to the submission return type (if needed):
Dim
expression
=
(
DirectCast
(
boundStatement
,
BoundExpressionStatement
)).
Expression
If
expression
.
Type
Is
Nothing
OrElse
expression
.
Type
.
SpecialType
<>
SpecialType
.
System_Void
Then
Dim
submissionReturnType
=
Compilation
.
GetSubmissionInitializer
()
.
ResultType
Dim
submissionReturnType
=
scriptInitializerOpt
.
ResultType
expression
=
ApplyImplicitConversion
(
expression
.
Syntax
,
submissionReturnType
,
expression
,
diagnostics
)
boundStatement
=
New
BoundExpressionStatement
(
boundStatement
.
Syntax
,
expression
,
expression
.
HasErrors
)
End
If
...
...
src/Compilers/VisualBasic/Portable/Compilation/MethodCompiler.vb
浏览文件 @
8ea9ab66
...
...
@@ -267,30 +267,29 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Debug
.
Assert
(
Not
entryPointAndDiagnostics
.
Diagnostics
.
IsDefault
)
diagnostics
.
AddRange
(
entryPointAndDiagnostics
.
Diagnostics
)
Dim
entryPoint
=
TryCast
(
entryPointAndDiagnostics
.
MethodSymbol
,
SynthesizedEntryPointSymbol
)
If
entryPoint
IsNot
Nothing
Then
If
moduleBeingBuilt
IsNot
Nothing
AndAlso
Not
diagnostics
.
HasAnyErrors
Then
Dim
compilationState
=
New
TypeCompilationState
(
compilation
,
moduleBeingBuilt
,
initializeComponentOpt
:
=
Nothing
)
Dim
body
=
entryPoint
.
CreateBody
()
Dim
emittedBody
=
GenerateMethodBody
(
moduleBeingBuilt
,
entryPoint
,
methodOrdinal
:
=
DebugId
.
UndefinedOrdinal
,
block
:
=
body
,
lambdaDebugInfo
:
=
ImmutableArray
(
Of
LambdaDebugInfo
).
Empty
,
closureDebugInfo
:
=
ImmutableArray
(
Of
ClosureDebugInfo
).
Empty
,
stateMachineTypeOpt
:
=
Nothing
,
variableSlotAllocatorOpt
:
=
Nothing
,
debugDocumentProvider
:
=
Nothing
,
diagnostics
:
=
diagnostics
,
emittingPdb
:
=
False
)
moduleBeingBuilt
.
SetMethodBody
(
entryPoint
,
emittedBody
)
End
If
Dim
entryPoint
=
entryPointAndDiagnostics
.
MethodSymbol
Dim
synthesizedEntryPoint
=
TryCast
(
entryPoint
,
SynthesizedEntryPointSymbol
)
If
synthesizedEntryPoint
IsNot
Nothing
AndAlso
moduleBeingBuilt
IsNot
Nothing
AndAlso
Not
diagnostics
.
HasAnyErrors
Then
Dim
compilationState
=
New
TypeCompilationState
(
compilation
,
moduleBeingBuilt
,
initializeComponentOpt
:
=
Nothing
)
Dim
body
=
synthesizedEntryPoint
.
CreateBody
()
Dim
emittedBody
=
GenerateMethodBody
(
moduleBeingBuilt
,
synthesizedEntryPoint
,
methodOrdinal
:
=
DebugId
.
UndefinedOrdinal
,
block
:
=
body
,
lambdaDebugInfo
:
=
ImmutableArray
(
Of
LambdaDebugInfo
).
Empty
,
closureDebugInfo
:
=
ImmutableArray
(
Of
ClosureDebugInfo
).
Empty
,
stateMachineTypeOpt
:
=
Nothing
,
variableSlotAllocatorOpt
:
=
Nothing
,
debugDocumentProvider
:
=
Nothing
,
diagnostics
:
=
diagnostics
,
emittingPdb
:
=
False
)
moduleBeingBuilt
.
SetMethodBody
(
synthesizedEntryPoint
,
emittedBody
)
End
If
Debug
.
Assert
(
entryPoint
AndDiagnostics
.
MethodSymbol
IsNot
Nothing
OrElse
entryPointAndDiagnostics
.
Diagnostics
.
HasAnyErrors
()
OrElse
Not
compilation
.
Options
.
Errors
.
IsDefaultOrEmpty
)
Return
entryPoint
AndDiagnostics
.
MethodSymbol
Debug
.
Assert
(
entryPoint
IsNot
Nothing
OrElse
entryPointAndDiagnostics
.
Diagnostics
.
HasAnyErrors
()
OrElse
Not
compilation
.
Options
.
Errors
.
IsDefaultOrEmpty
)
Return
entryPoint
End
Function
Private
Sub
WaitForWorkers
()
...
...
src/Scripting/Test/Session.cs
浏览文件 @
8ea9ab66
...
...
@@ -143,13 +143,6 @@ public object Execute(string code)
public
T
Execute
<
T
>(
string
code
)
{
var
value
=
this
.
ExecuteAsync
<
T
>(
code
,
CancellationToken
.
None
);
if
(
value
==
null
)
{
// ReturnValue will be null if there are errors or
// if there is no executable code in submission.
return
default
(
T
);
}
return
value
.
Result
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录