Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
07387747
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,发现更多精彩内容 >>
提交
07387747
编写于
3月 02, 2015
作者:
C
Charles Stoner
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/master' into 1130978
上级
69b1bdd2
cbd9e3ff
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
407 addition
and
184 deletion
+407
-184
src/Compilers/CSharp/Desktop/CommandLine/CommandLineParser.cs
...Compilers/CSharp/Desktop/CommandLine/CommandLineParser.cs
+1
-13
src/Compilers/VisualBasic/Desktop/CommandLine/CommandLineParser.vb
...lers/VisualBasic/Desktop/CommandLine/CommandLineParser.vb
+1
-10
src/Compilers/VisualBasic/Desktop/VisualBasicSerializableCompilationOptions.vb
...asic/Desktop/VisualBasicSerializableCompilationOptions.vb
+3
-0
src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb
...isualBasic/Portable/Compilation/VisualBasicCompilation.vb
+5
-3
src/Compilers/VisualBasic/Portable/VisualBasicCompilationOptions.vb
...ers/VisualBasic/Portable/VisualBasicCompilationOptions.vb
+40
-1
src/Compilers/VisualBasic/Test/Semantic/Binding/Binder_Expressions_Tests.vb
...alBasic/Test/Semantic/Binding/Binder_Expressions_Tests.vb
+124
-149
src/Compilers/VisualBasic/Test/Semantic/Compilation/VisualBasicCompilationOptionsTests.vb
...emantic/Compilation/VisualBasicCompilationOptionsTests.vb
+1
-0
src/EditorFeatures/CSharpTest/Recommendations/ThisKeywordRecommenderTests.cs
...CSharpTest/Recommendations/ThisKeywordRecommenderTests.cs
+92
-0
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalsTests.cs
...onEvaluator/CSharp/Test/ExpressionCompiler/LocalsTests.cs
+50
-0
src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Engine.il
.../Source/Concord/Microsoft.VisualStudio.Debugger.Engine.il
+2
-2
src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Metadata.il
...ource/Concord/Microsoft.VisualStudio.Debugger.Metadata.il
+2
-2
src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/CompilationExtensions.vb
...lBasic/Source/ExpressionCompiler/CompilationExtensions.vb
+2
-1
src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/ExpressionCompilerTests.vb
...lBasic/Test/ExpressionCompiler/ExpressionCompilerTests.vb
+6
-2
src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/LocalsTests.vb
...luator/VisualBasic/Test/ExpressionCompiler/LocalsTests.vb
+53
-0
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
.../Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
+6
-1
src/Workspaces/CSharp/Portable/Extensions/MemberDeclarationSyntaxExtensions.cs
.../Portable/Extensions/MemberDeclarationSyntaxExtensions.cs
+19
-0
未找到文件。
src/Compilers/CSharp/Desktop/CommandLine/CommandLineParser.cs
浏览文件 @
07387747
...
...
@@ -1477,19 +1477,7 @@ private static void ValidateWin32Settings(string win32ResourceFile, string win32
{
// Use FileShare.ReadWrite because the file could be opened by the current process.
// For example, it is an XML doc file produced by the build.
var
stream
=
new
FileStream
(
fullPath
,
FileMode
.
Open
,
FileAccess
.
Read
,
FileShare
.
ReadWrite
);
// Lock the entire content to prevent others from modifying it while we are reading.
try
{
stream
.
Lock
(
0
,
long
.
MaxValue
);
return
stream
;
}
catch
{
stream
.
Dispose
();
throw
;
}
return
new
FileStream
(
fullPath
,
FileMode
.
Open
,
FileAccess
.
Read
,
FileShare
.
ReadWrite
);
};
return
new
ResourceDescription
(
resourceName
,
fileName
,
dataProvider
,
isPublic
,
embedded
,
checkArgs
:
false
);
}
...
...
src/Compilers/VisualBasic/Desktop/CommandLine/CommandLineParser.vb
浏览文件 @
07387747
...
...
@@ -1388,16 +1388,7 @@ lVbRuntimePlus:
Dim
dataProvider
As
Func
(
Of
Stream
)
=
Function
()
' Use FileShare.ReadWrite because the file could be opened by the current process.
' For example, it Is an XML doc file produced by the build.
Dim
stream
=
New
FileStream
(
fullPath
,
FileMode
.
Open
,
FileAccess
.
Read
,
FileShare
.
ReadWrite
)
' Lock the entire content to prevent others from modifying it while we are reading.
Try
stream
.
Lock
(
0
,
Long
.
MaxValue
)
Return
stream
Catch
stream
.
Dispose
()
Throw
End
Try
Return
New
FileStream
(
fullPath
,
FileMode
.
Open
,
FileAccess
.
Read
,
FileShare
.
ReadWrite
)
End
Function
Return
New
ResourceDescription
(
resourceName
,
fileName
,
dataProvider
,
isPublic
,
embedded
,
checkArgs
:
=
False
)
End
Function
...
...
src/Compilers/VisualBasic/Desktop/VisualBasicSerializableCompilationOptions.vb
浏览文件 @
07387747
...
...
@@ -18,6 +18,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Private
Const
OptionExplicitString
=
"OptionExplicit"
Private
Const
OptionCompareTextString
=
"OptionCompareText"
Private
Const
EmbedVbCoreRuntimeString
=
"EmbedVbCoreRuntime"
Private
Const
SuppressEmbeddedDeclarations
=
"SuppressEmbeddedDeclarations"
Private
Const
ParseOptionsString
=
"ParseOptions"
Sub
New
(
options
As
VisualBasicCompilationOptions
)
...
...
@@ -60,6 +61,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
optionExplicit
:
=
info
.
GetBoolean
(
OptionExplicitString
),
optionCompareText
:
=
info
.
GetBoolean
(
OptionCompareTextString
),
embedVbCoreRuntime
:
=
info
.
GetBoolean
(
EmbedVbCoreRuntimeString
),
suppressEmbeddedDeclarations
:
=
info
.
GetBoolean
(
SuppressEmbeddedDeclarations
),
parseOptions
:
=
If
(
serializableOptions
IsNot
Nothing
,
serializableOptions
.
Options
,
Nothing
))
End
Sub
...
...
@@ -73,6 +75,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
info
.
AddValue
(
OptionExplicitString
,
_options
.
OptionExplicit
)
info
.
AddValue
(
OptionCompareTextString
,
_options
.
OptionCompareText
)
info
.
AddValue
(
EmbedVbCoreRuntimeString
,
_options
.
EmbedVbCoreRuntime
)
info
.
AddValue
(
SuppressEmbeddedDeclarations
,
_options
.
SuppressEmbeddedDeclarations
)
info
.
AddValue
(
ParseOptionsString
,
If
(
_options
.
ParseOptions
IsNot
Nothing
,
New
VisualBasicSerializableParseOptions
(
_options
.
ParseOptions
),
Nothing
))
End
Sub
...
...
src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb
浏览文件 @
07387747
...
...
@@ -225,11 +225,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Friend
Property
MyTemplate
As
SyntaxTree
Get
If
m_lazyMyTemplate
Is
VisualBasicSyntaxTree
.
Dummy
Then
If
Me
.
Options
.
EmbedVbCoreRuntime
Then
Dim
compilationOptions
=
Me
.
Options
If
compilationOptions
.
EmbedVbCoreRuntime
OrElse
compilationOptions
.
SuppressEmbeddedDeclarations
Then
m_lazyMyTemplate
=
Nothing
Else
' first see whether we can use one from global cache
Dim
parseOptions
=
If
(
Me
.
Options
.
ParseOptions
,
VisualBasicParseOptions
.
Default
)
Dim
parseOptions
=
If
(
compilation
Options
.
ParseOptions
,
VisualBasicParseOptions
.
Default
)
Dim
tree
As
SyntaxTree
=
Nothing
If
s_myTemplateCache
.
TryGetValue
(
parseOptions
,
tree
)
Then
...
...
@@ -1108,7 +1109,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
' In new flavors of the framework, types, that XML helpers depend upon, are
' defined in assemblies with different names. Let's not hardcode these names,
' let's check for presence of types instead.
Return
InternalXmlHelperDependencyIsSatisfied
(
WellKnownType
.
System_Linq_Enumerable
)
AndAlso
Return
Not
Me
.
Options
.
SuppressEmbeddedDeclarations
AndAlso
InternalXmlHelperDependencyIsSatisfied
(
WellKnownType
.
System_Linq_Enumerable
)
AndAlso
InternalXmlHelperDependencyIsSatisfied
(
WellKnownType
.
System_Xml_Linq_XElement
)
AndAlso
InternalXmlHelperDependencyIsSatisfied
(
WellKnownType
.
System_Xml_Linq_XName
)
AndAlso
InternalXmlHelperDependencyIsSatisfied
(
WellKnownType
.
System_Xml_Linq_XAttribute
)
AndAlso
...
...
src/Compilers/VisualBasic/Portable/VisualBasicCompilationOptions.vb
浏览文件 @
07387747
...
...
@@ -29,6 +29,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Private
_embedVbCoreRuntime
As
Boolean
Private
_parseOptions
As
VisualBasicParseOptions
' The assemblies emitted by the expression compiler should never contain embedded declarations -
' those should come from the user's code.
Private
_suppressEmbeddedDeclarations
As
Boolean
''' <summary>
''' Initializes a new instance of the VisualBasicCompilationOptions type with various options.
''' </summary>
...
...
@@ -108,6 +112,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
generalDiagnosticOption
,
specificDiagnosticOptions
,
concurrentBuild
,
suppressEmbeddedDeclarations
:
=
False
,
extendedCustomDebugInformation
:
=
True
,
xmlReferenceResolver
:
=
xmlReferenceResolver
,
sourceReferenceResolver
:
=
sourceReferenceResolver
,
...
...
@@ -141,6 +146,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
generalDiagnosticOption
As
ReportDiagnostic
,
specificDiagnosticOptions
As
IEnumerable
(
Of
KeyValuePair
(
Of
String
,
ReportDiagnostic
)),
concurrentBuild
As
Boolean
,
suppressEmbeddedDeclarations
As
Boolean
,
extendedCustomDebugInformation
As
Boolean
,
xmlReferenceResolver
As
XmlReferenceResolver
,
sourceReferenceResolver
As
SourceReferenceResolver
,
...
...
@@ -181,7 +187,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
_optionExplicit
=
optionExplicit
_optionCompareText
=
optionCompareText
_embedVbCoreRuntime
=
embedVbCoreRuntime
_suppressEmbeddedDeclarations
=
suppressEmbeddedDeclarations
_parseOptions
=
parseOptions
Debug
.
Assert
(
Not
(
_embedVbCoreRuntime
AndAlso
_suppressEmbeddedDeclarations
),
"_embedVbCoreRuntime and _suppressEmbeddedDeclarations are mutually exclusive"
)
End
Sub
Private
Sub
New
(
other
As
VisualBasicCompilationOptions
)
...
...
@@ -198,6 +208,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
optionCompareText
:
=
other
.
OptionCompareText
,
parseOptions
:
=
other
.
ParseOptions
,
embedVbCoreRuntime
:
=
other
.
EmbedVbCoreRuntime
,
suppressEmbeddedDeclarations
:
=
other
.
SuppressEmbeddedDeclarations
,
optimizationLevel
:
=
other
.
OptimizationLevel
,
checkOverflow
:
=
other
.
CheckOverflow
,
cryptoKeyContainer
:
=
other
.
CryptoKeyContainer
,
...
...
@@ -301,6 +312,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End
Get
End
Property
''' <summary>
''' Gets the embedded declaration suppression setting.
''' </summary>
''' <returns>
''' The embedded declaration suppression setting.
''' </returns>
Friend
ReadOnly
Property
SuppressEmbeddedDeclarations
As
Boolean
Get
Return
_suppressEmbeddedDeclarations
End
Get
End
Property
''' <summary>
''' Gets the Parse Options setting.
''' Compilation level parse options. Used when compiling synthetic embedded code such as My template
...
...
@@ -512,6 +535,20 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return
New
VisualBasicCompilationOptions
(
Me
)
With
{.
ExtendedCustomDebugInformation_internal_protected_set
=
extendedCustomDebugInformation
}
End
Function
''' <summary>
''' Creates a new VisualBasicCompilationOptions instance with different embedded declaration suppression setting specified.
''' </summary>
''' <param name="suppressEmbeddedDeclarations">The embedded declaration suppression setting. </param>
''' <returns>A new instance of VisualBasicCompilationOptions, if the embedded declaration suppression setting is different; otherwise current instance.</returns>
''' <remarks>Only expected to be called from the expression compiler.</remarks>
Friend
Function
WithSuppressEmbeddedDeclarations
(
suppressEmbeddedDeclarations
As
Boolean
)
As
VisualBasicCompilationOptions
If
suppressEmbeddedDeclarations
=
_suppressEmbeddedDeclarations
Then
Return
Me
End
If
Return
New
VisualBasicCompilationOptions
(
Me
)
With
{.
_suppressEmbeddedDeclarations
=
suppressEmbeddedDeclarations
}
End
Function
''' <summary>
''' Creates a new VisualBasicCompilationOptions instance with a different cryptography key container specified
''' </summary>
...
...
@@ -805,6 +842,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Me
.
OptionExplicit
=
other
.
OptionExplicit
AndAlso
Me
.
OptionCompareText
=
other
.
OptionCompareText
AndAlso
Me
.
EmbedVbCoreRuntime
=
other
.
EmbedVbCoreRuntime
AndAlso
Me
.
SuppressEmbeddedDeclarations
=
other
.
SuppressEmbeddedDeclarations
AndAlso
If
(
Me
.
ParseOptions
Is
Nothing
,
other
.
ParseOptions
Is
Nothing
,
Me
.
ParseOptions
.
Equals
(
other
.
ParseOptions
))
End
Function
...
...
@@ -831,7 +869,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Hash
.
Combine
(
Me
.
OptionExplicit
,
Hash
.
Combine
(
Me
.
OptionCompareText
,
Hash
.
Combine
(
Me
.
EmbedVbCoreRuntime
,
Hash
.
Combine
(
Me
.
ParseOptions
,
0
)))))))))
Hash
.
Combine
(
Me
.
SuppressEmbeddedDeclarations
,
Hash
.
Combine
(
Me
.
ParseOptions
,
0
))))))))))
End
Function
End
Class
End
Namespace
src/Compilers/VisualBasic/Test/Semantic/Binding/Binder_Expressions_Tests.vb
浏览文件 @
07387747
此差异已折叠。
点击以展开。
src/Compilers/VisualBasic/Test/Semantic/Compilation/VisualBasicCompilationOptionsTests.vb
浏览文件 @
07387747
...
...
@@ -495,6 +495,7 @@ BC2042: The options /vbruntime* and /target:module cannot be combined.
"OptionExplicit"
,
"OptionCompareText"
,
"EmbedVbCoreRuntime"
,
"SuppressEmbeddedDeclarations"
,
"ParseOptions"
)
End
Sub
...
...
src/EditorFeatures/CSharpTest/Recommendations/ThisKeywordRecommenderTests.cs
浏览文件 @
07387747
...
...
@@ -526,5 +526,97 @@ void M()
{
var c = new C { x = 2, y = 3, $$"
);
}
[
WorkItem
(
725
,
"https://github.com/dotnet/roslyn/issues/725"
)]
[
WorkItem
(
1107414
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
KeywordRecommending
)]
public
void
InExpressionBodiedMembersProperty
()
{
VerifyKeyword
(
@"
class C
{
int x;
int M => $$
int p;
}"
);
}
[
WorkItem
(
725
,
"https://github.com/dotnet/roslyn/issues/725"
)]
[
WorkItem
(
1107414
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
KeywordRecommending
)]
public
void
InExpressionBodiedMembersMethod
()
{
VerifyKeyword
(
@"
class C
{
int x;
int give() => $$"
);
}
[
WorkItem
(
725
,
"https://github.com/dotnet/roslyn/issues/725"
)]
[
WorkItem
(
1107414
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
KeywordRecommending
)]
public
void
InExpressionBodiedMembersIndexer
()
{
VerifyKeyword
(
@"
class C
{
int x;
public object this[int i] => $$"
);
}
[
WorkItem
(
725
,
"https://github.com/dotnet/roslyn/issues/725"
)]
[
WorkItem
(
1107414
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
KeywordRecommending
)]
public
void
NotInExpressionBodiedMembers_Static
()
{
VerifyAbsence
(
@"
class C
{
int x;
static int M => $$"
);
}
[
WorkItem
(
725
,
"https://github.com/dotnet/roslyn/issues/725"
)]
[
WorkItem
(
1107414
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
KeywordRecommending
)]
public
void
NotInExpressionBodiedMembersOperator
()
{
VerifyAbsence
(
@"
class C
{
int x;
public static C operator - (C c1) => $$"
);
}
[
WorkItem
(
725
,
"https://github.com/dotnet/roslyn/issues/725"
)]
[
WorkItem
(
1107414
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
KeywordRecommending
)]
public
void
NotInExpressionBodiedMembersConversionOperator
()
{
VerifyAbsence
(
@"
class F
{
}
class C
{
int x;
public static explicit operator F(C c1) => $$"
);
}
[
WorkItem
(
725
,
"https://github.com/dotnet/roslyn/issues/725"
)]
[
WorkItem
(
1107414
)]
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
KeywordRecommending
)]
public
void
OutsideExpressionBodiedMember
()
{
VerifyAbsence
(
@"
class C
{
int x;
int M => this.x;$$
int p;
}"
);
}
}
}
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/LocalsTests.cs
浏览文件 @
07387747
...
...
@@ -2392,6 +2392,56 @@ .maxstack 1
locals
.
Free
();
}
[
WorkItem
(
947
)]
[
Fact
]
public
void
DuplicateEditorBrowsableAttributes
()
{
const
string
libSource
=
@"
namespace System.ComponentModel
{
public enum EditorBrowsableState
{
Always = 0,
Never = 1,
Advanced = 2
}
[AttributeUsage(AttributeTargets.All)]
internal sealed class EditorBrowsableAttribute : Attribute
{
public EditorBrowsableAttribute(EditorBrowsableState state) { }
}
}
"
;
const
string
source
=
@"
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
class C
{
void M()
{
}
}
"
;
var
libRef
=
CreateCompilationWithMscorlib
(
libSource
).
EmitToImageReference
();
var
comp
=
CreateCompilationWithMscorlib
(
source
,
new
[]
{
SystemRef
},
TestOptions
.
DebugDll
);
byte
[]
exeBytes
;
byte
[]
pdbBytes
;
ImmutableArray
<
MetadataReference
>
unusedReferences
;
var
result
=
comp
.
EmitAndGetReferences
(
out
exeBytes
,
out
pdbBytes
,
out
unusedReferences
);
Assert
.
True
(
result
);
var
runtime
=
CreateRuntimeInstance
(
GetUniqueName
(),
ImmutableArray
.
Create
(
MscorlibRef
,
SystemRef
,
SystemCoreRef
,
SystemXmlLinqRef
,
libRef
),
exeBytes
,
new
SymReader
(
pdbBytes
));
string
typeName
;
var
locals
=
ArrayBuilder
<
LocalAndMethod
>.
GetInstance
();
CompilationTestData
testData
;
GetLocals
(
runtime
,
"C.M"
,
argumentsOnly
:
false
,
locals
:
locals
,
count
:
1
,
typeName
:
out
typeName
,
testData
:
out
testData
);
Assert
.
Equal
(
"this"
,
locals
.
Single
().
LocalName
);
locals
.
Free
();
}
private
static
void
GetLocals
(
RuntimeInstance
runtime
,
string
methodName
,
bool
argumentsOnly
,
ArrayBuilder
<
LocalAndMethod
>
locals
,
int
count
,
out
string
typeName
,
out
CompilationTestData
testData
)
{
var
context
=
CreateMethodContext
(
runtime
,
methodName
);
...
...
src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Engine.il
浏览文件 @
07387747
...
...
@@ -39,13 +39,13 @@
.ver 1:0:0:0
}
.module Microsoft.VisualStudio.Debugger.Engine.dll
// MVID: {
F69E895E-D452-4E38-95BE-7B90DD70E62B
}
// MVID: {
163431D2-419D-4E9C-8C45-797F632D58BA
}
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x0
18D
0000
// Image base: 0x0
2B5
0000
// =============== CLASS MEMBERS DECLARATION ===================
src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Metadata.il
浏览文件 @
07387747
...
...
@@ -38,13 +38,13 @@
.ver 14:0:0:0
}
.module Microsoft.VisualStudio.Debugger.Metadata.dll
// MVID: {
9E55C756-FD12-43E3-ADCD-A828058B43EB
}
// MVID: {
AAC4EFF2-9AD3-4C4A-9D40-218365A20C54
}
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
// Image base: 0x00
E6
0000
// Image base: 0x00
BC
0000
// =============== CLASS MEMBERS DECLARATION ===================
...
...
src/ExpressionEvaluator/VisualBasic/Source/ExpressionCompiler/CompilationExtensions.vb
浏览文件 @
07387747
...
...
@@ -102,7 +102,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator
platform
:
=
Platform
.
AnyCpu
,
' Platform should match PEModule.Machine, in this case I386.
optimizationLevel
:
=
OptimizationLevel
.
Release
,
assemblyIdentityComparer
:
=
DesktopAssemblyIdentityComparer
.
Default
).
WithMetadataImportOptions
(
MetadataImportOptions
.
All
)
WithMetadataImportOptions
(
MetadataImportOptions
.
All
).
WithSuppressEmbeddedDeclarations
(
True
)
End
Module
...
...
src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/ExpressionCompilerTests.vb
浏览文件 @
07387747
...
...
@@ -1694,7 +1694,8 @@ End Class
Assert
.
Equal
(
DkmEvaluationResultStorageType
.
None
,
resultProperties
.
StorageType
)
End
Sub
<
Fact
>
<
WorkItem
(
964
,
"GitHub"
)
>
<
Fact
(
Skip
:
=
"964"
)
>
Public
Sub
EvaluateXmlMemberAccess
()
Dim
source
=
"Class C
...
...
@@ -1721,6 +1722,7 @@ End Class"
Dim
errorMessage
As
String
=
Nothing
Dim
testData
=
New
CompilationTestData
()
Dim
result
=
context
.
CompileExpression
(
"x.@a"
,
resultProperties
,
errorMessage
,
testData
,
VisualBasicDiagnosticFormatter
.
Instance
)
Assert
.
Null
(
errorMessage
)
testData
.
GetMethodData
(
"<>x.<>m0"
).
VerifyIL
(
"{
// Code size 22 (0x16)
...
...
@@ -3119,7 +3121,8 @@ End Module
End
Sub
<
WorkItem
(
1042918
)
>
<
Fact
>
<
WorkItem
(
964
,
"GitHub"
)
>
<
Fact
(
Skip
:
=
"964"
)
>
Public
Sub
ConditionalAccessExpressionType
()
Dim
source
=
"Class C
...
...
@@ -3179,6 +3182,7 @@ End Class"
testData
=
New
CompilationTestData
()
result
=
context
.
CompileExpression
(
"Me?.X.@a"
,
resultProperties
,
errorMessage
,
testData
,
VisualBasicDiagnosticFormatter
.
Instance
)
Assert
.
Null
(
errorMessage
)
methodData
=
testData
.
GetMethodData
(
"<>x.<>m0"
)
Assert
.
Equal
(
DirectCast
(
methodData
.
Method
,
MethodSymbol
).
ReturnType
.
SpecialType
,
SpecialType
.
System_String
)
methodData
.
VerifyIL
(
...
...
src/ExpressionEvaluator/VisualBasic/Test/ExpressionCompiler/LocalsTests.vb
浏览文件 @
07387747
...
...
@@ -2414,6 +2414,59 @@ End Class"
locals
.
Free
()
End
Sub
<
WorkItem
(
947
)
>
<
Fact
>
Public
Sub
DuplicateEditorBrowsableAttributes
()
Const
libSource
=
"
Namespace System.ComponentModel
Public Enum EditorBrowsableState
Always = 0
Never = 1
Advanced = 2
End Enum
<AttributeUsage(AttributeTargets.All)>
Friend NotInheritable Class EditorBrowsableAttribute
Inherits Attribute
Public Sub New(state As EditorBrowsableState)
End Sub
End Class
End Namespace
"
Const
source
=
"
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)>
Class C
Sub M()
End Sub
End Class
"
Dim
libRef
=
CreateCompilationWithMscorlib
({
libSource
},
compOptions
:
=
TestOptions
.
DebugDll
).
EmitToImageReference
()
Dim
comp
=
CreateCompilationWithReferences
({
VisualBasicSyntaxTree
.
ParseText
(
source
)},
{
MscorlibRef
,
SystemRef
},
TestOptions
.
DebugDll
)
Dim
exeBytes
As
Byte
()
=
Nothing
Dim
pdbBytes
As
Byte
()
=
Nothing
Dim
unusedReferences
As
ImmutableArray
(
Of
MetadataReference
)
=
Nothing
Dim
result
=
comp
.
EmitAndGetReferences
(
exeBytes
,
pdbBytes
,
unusedReferences
)
Assert
.
True
(
result
)
' Referencing SystemCoreRef and SystemXmlLinqRef will cause Microsoft.VisualBasic.Embedded to be compiled
' and it depends on EditorBrowsableAttribute.
Dim
runtimeReferences
=
ImmutableArray
.
Create
(
MscorlibRef
,
SystemRef
,
SystemCoreRef
,
SystemXmlLinqRef
,
libRef
)
Dim
runtime
=
CreateRuntimeInstance
(
GetUniqueName
(),
runtimeReferences
,
exeBytes
,
New
SymReader
(
pdbBytes
))
Dim
typeName
As
String
=
Nothing
Dim
locals
=
ArrayBuilder
(
Of
LocalAndMethod
).
GetInstance
()
Dim
testData
As
CompilationTestData
=
Nothing
GetLocals
(
runtime
,
"C.M"
,
argumentsOnly
:
=
False
,
locals
:
=
locals
,
count
:
=
1
,
typeName
:
=
typeName
,
testData
:
=
testData
)
Assert
.
Equal
(
"Me"
,
locals
.
Single
().
LocalName
)
locals
.
Free
()
End
Sub
Private
Shared
Sub
GetLocals
(
runtime
As
RuntimeInstance
,
methodName
As
String
,
argumentsOnly
As
Boolean
,
locals
As
ArrayBuilder
(
Of
LocalAndMethod
),
count
As
Integer
,
ByRef
typeName
As
String
,
ByRef
testData
As
CompilationTestData
)
Dim
context
=
CreateMethodContext
(
runtime
,
methodName
)
testData
=
New
CompilationTestData
()
...
...
src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs
浏览文件 @
07387747
...
...
@@ -3,7 +3,6 @@
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading
;
using
Microsoft.CodeAnalysis.CSharp
;
using
Microsoft.CodeAnalysis.CSharp.Symbols
;
using
Microsoft.CodeAnalysis.CSharp.Syntax
;
using
Microsoft.CodeAnalysis.CSharp.Utilities
;
...
...
@@ -1422,6 +1421,12 @@ public static bool IsInstanceContext(this SyntaxTree syntaxTree, int position, S
return
false
;
}
var
expressionBody
=
containingMember
.
GetExpressionBody
();
if
(
expressionBody
!=
null
)
{
return
TextSpan
.
FromBounds
(
expressionBody
.
ArrowToken
.
Span
.
End
,
expressionBody
.
FullSpan
.
End
).
IntersectsWith
(
position
);
}
// Must be a property or something method-like.
if
(
containingMember
.
HasMethodShape
())
{
...
...
src/Workspaces/CSharp/Portable/Extensions/MemberDeclarationSyntaxExtensions.cs
浏览文件 @
07387747
...
...
@@ -316,6 +316,25 @@ public static BlockSyntax GetBody(this MemberDeclarationSyntax memberDeclaration
return
null
;
}
public
static
ArrowExpressionClauseSyntax
GetExpressionBody
(
this
MemberDeclarationSyntax
memberDeclaration
)
{
switch
(
memberDeclaration
?.
Kind
())
{
case
SyntaxKind
.
PropertyDeclaration
:
return
((
PropertyDeclarationSyntax
)
memberDeclaration
).
ExpressionBody
;
case
SyntaxKind
.
MethodDeclaration
:
return
((
MethodDeclarationSyntax
)
memberDeclaration
).
ExpressionBody
;
case
SyntaxKind
.
IndexerDeclaration
:
return
((
IndexerDeclarationSyntax
)
memberDeclaration
).
ExpressionBody
;
case
SyntaxKind
.
OperatorDeclaration
:
return
((
OperatorDeclarationSyntax
)
memberDeclaration
).
ExpressionBody
;
case
SyntaxKind
.
ConversionOperatorDeclaration
:
return
((
ConversionOperatorDeclarationSyntax
)
memberDeclaration
).
ExpressionBody
;
default
:
return
null
;
}
}
public
static
MemberDeclarationSyntax
WithBody
(
this
MemberDeclarationSyntax
memberDeclaration
,
BlockSyntax
body
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录