Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
0f4eeb5d
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,发现更多精彩内容 >>
提交
0f4eeb5d
编写于
9月 09, 2014
作者:
C
ChuckStoner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added .winmd helper methods (changeset 1332312)
上级
def35ce5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
40 addition
and
52 deletion
+40
-52
Src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs
Src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs
+14
-14
Src/Compilers/Core/Portable/MetadataReader/MetadataHelpers.cs
...Compilers/Core/Portable/MetadataReader/MetadataHelpers.cs
+17
-0
Src/Compilers/Core/Portable/MetadataReference/AssemblyMetadata.cs
...ilers/Core/Portable/MetadataReference/AssemblyMetadata.cs
+2
-1
Src/Test/Utilities/CommonTestBase.CompilationVerifier.cs
Src/Test/Utilities/CommonTestBase.CompilationVerifier.cs
+1
-4
Src/Test/Utilities/HostedRuntimeEnvironment.cs
Src/Test/Utilities/HostedRuntimeEnvironment.cs
+6
-33
未找到文件。
Src/Compilers/CSharp/Portable/Symbols/ReferenceManager.cs
浏览文件 @
0f4eeb5d
...
...
@@ -371,20 +371,8 @@ private bool CreateAndSetSourceAssemblyFullBind(CSharpCompilation compilation)
if
((
object
)
bindingResult
[
i
].
AssemblySymbol
==
null
)
{
// symbols hasn't been found in the cache, create a new one
var
compilationData
=
allAssemblies
[
i
]
as
AssemblyDataForCompilation
;
if
(
compilationData
!=
null
)
{
bindingResult
[
i
].
AssemblySymbol
=
new
Symbols
.
Retargeting
.
RetargetingAssemblySymbol
(
compilationData
.
Compilation
.
SourceAssembly
,
compilationData
.
IsLinked
);
}
else
{
var
fileData
=
(
AssemblyDataForFile
)
allAssemblies
[
i
];
bindingResult
[
i
].
AssemblySymbol
=
new
PEAssemblySymbol
(
fileData
.
Assembly
,
fileData
.
DocumentationProvider
,
fileData
.
IsLinked
,
fileData
.
EffectiveImportOptions
);
}
var
compilationData
=
(
AssemblyDataForMetadataOrCompilation
)
allAssemblies
[
i
];
bindingResult
[
i
].
AssemblySymbol
=
compilationData
.
CreateAssemblySymbol
();
newSymbols
.
Add
(
i
);
}
...
...
@@ -822,6 +810,8 @@ protected AssemblyDataForMetadataOrCompilation(bool embedInteropTypes)
this
.
EmbedInteropTypes
=
embedInteropTypes
;
}
internal
abstract
AssemblySymbol
CreateAssemblySymbol
();
public
override
AssemblyIdentity
Identity
{
get
...
...
@@ -943,6 +933,11 @@ public DocumentationProvider DocumentationProvider
private
bool
internalsVisibleComputed
=
false
;
private
bool
internalsPotentiallyVisibleToCompilation
=
false
;
internal
override
AssemblySymbol
CreateAssemblySymbol
()
{
return
new
PEAssemblySymbol
(
this
.
assembly
,
this
.
documentationProvider
,
this
.
IsLinked
,
this
.
EffectiveImportOptions
);
}
internal
bool
InternalsMayBeVisibleToCompilation
{
get
...
...
@@ -1089,6 +1084,11 @@ public AssemblyDataForCompilation(CSharpCompilation compilation, bool embedInter
referencedAssemblies
=
refs
.
ToImmutableAndFree
();
}
internal
override
AssemblySymbol
CreateAssemblySymbol
()
{
return
new
Symbols
.
Retargeting
.
RetargetingAssemblySymbol
(
this
.
compilation
.
SourceAssembly
,
this
.
IsLinked
);
}
protected
override
void
AddAvailableSymbols
(
List
<
AssemblySymbol
>
assemblies
)
{
assemblies
.
Add
(
compilation
.
Assembly
);
...
...
Src/Compilers/Core/Portable/MetadataReader/MetadataHelpers.cs
浏览文件 @
0f4eeb5d
...
...
@@ -862,5 +862,22 @@ internal static bool SplitNameEqualsFullyQualifiedName(string namespaceName, str
fullyQualified
.
StartsWith
(
namespaceName
,
StringComparison
.
Ordinal
)
&&
fullyQualified
.
EndsWith
(
typeName
,
StringComparison
.
Ordinal
);
}
/// <summary>
/// Returns true if the metadata name is a compile-time .winmd assembly name.
/// </summary>
internal
static
bool
IsCompileTimeWinMd
(
string
metadataName
)
{
return
string
.
Equals
(
metadataName
,
"windows.winmd"
,
StringComparison
.
OrdinalIgnoreCase
);
}
/// <summary>
/// Returns true if the metadata name is a runtime .winmd assembly name.
/// </summary>
internal
static
bool
IsRuntimeWinMd
(
string
metadataName
)
{
return
!
IsCompileTimeWinMd
(
metadataName
)
&&
metadataName
.
EndsWith
(
".winmd"
,
StringComparison
.
OrdinalIgnoreCase
);
}
}
}
Src/Compilers/Core/Portable/MetadataReference/AssemblyMetadata.cs
浏览文件 @
0f4eeb5d
...
...
@@ -219,7 +219,8 @@ internal bool IsValidAssembly()
for
(
int
i
=
1
;
i
<
Modules
.
Length
;
i
++)
{
if
(!
Modules
[
i
].
Module
.
IsLinkedModule
)
var
module
=
Modules
[
i
].
Module
;
if
(!
module
.
IsLinkedModule
&&
!
MetadataHelpers
.
IsRuntimeWinMd
(
module
.
Name
))
{
return
false
;
}
...
...
Src/Test/Utilities/CommonTestBase.CompilationVerifier.cs
浏览文件 @
0f4eeb5d
...
...
@@ -85,12 +85,9 @@ internal ImmutableArray<ModuleMetadata> GetAllModuleMetadata()
public
void
Emit
(
string
expectedOutput
,
IEnumerable
<
ResourceDescription
>
manifestResources
,
bool
peVerify
,
SignatureDescription
[]
expectedSignatures
)
{
bool
doExecute
=
expectedOutput
!=
null
;
using
(
var
testEnvironment
=
new
HostedRuntimeEnvironment
(
dependencies
))
{
string
mainModuleName
=
Emit
(
testEnvironment
,
manifestResources
);
allModuleData
=
testEnvironment
.
GetAllModuleData
();
if
(
peVerify
)
...
...
@@ -103,7 +100,7 @@ public void Emit(string expectedOutput, IEnumerable<ResourceDescription> manifes
MetadataSignatureUnitTestHelper
.
VerifyMemberSignatures
(
testEnvironment
,
expectedSignatures
);
}
if
(
doExecute
)
if
(
expectedOutput
!=
null
)
{
testEnvironment
.
Execute
(
mainModuleName
,
expectedOutput
);
}
...
...
Src/Test/Utilities/HostedRuntimeEnvironment.cs
浏览文件 @
0f4eeb5d
...
...
@@ -8,24 +8,16 @@
using
System.IO
;
using
System.Linq
;
using
System.Reflection
;
using
System.Runtime.InteropServices
;
using
System.Runtime.Serialization
;
using
System.Text
;
using
System.Threading
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.CodeGen
;
using
Microsoft.CodeAnalysis.Emit
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Roslyn.Utilities
;
namespace
Microsoft.CodeAnalysis.Test.Utilities
{
public
enum
OutputMatchKind
{
MatchAll
,
DoesNotMatch
}
public
class
HostedRuntimeEnvironment
:
IDisposable
{
private
static
readonly
Dictionary
<
string
,
Guid
>
allModuleNames
=
new
Dictionary
<
string
,
Guid
>();
...
...
@@ -269,35 +261,16 @@ public int Execute(string moduleName, int expectedOutputLength, out string proce
}
}
public
int
Execute
(
string
moduleName
,
string
expectedOutput
,
OutputMatchKind
outputMatchKind
=
OutputMatchKind
.
MatchAll
)
public
int
Execute
(
string
moduleName
,
string
expectedOutput
)
{
string
actualOutput
;
int
exitCode
=
Execute
(
moduleName
,
expectedOutput
.
Length
,
out
actualOutput
);
if
(
expectedOutput
!=
null
)
{
switch
(
outputMatchKind
)
{
case
OutputMatchKind
.
MatchAll
:
if
(
expectedOutput
.
Trim
()
!=
actualOutput
.
Trim
())
{
string
dumpDir
;
assemblyManager
.
DumpAssemblyData
(
out
dumpDir
);
throw
new
ExecutionException
(
expectedOutput
,
actualOutput
,
dumpDir
);
}
break
;
case
OutputMatchKind
.
DoesNotMatch
:
if
(
actualOutput
.
Contains
(
expectedOutput
))
{
string
dumpDir
;
assemblyManager
.
DumpAssemblyData
(
out
dumpDir
);
throw
new
ExecutionException
(
null
,
actualOutput
,
dumpDir
);
}
break
;
default
:
throw
new
NotSupportedException
(
"Unsupported OutputMatchKind: "
+
outputMatchKind
.
ToString
());
}
if
(
expectedOutput
.
Trim
()
!=
actualOutput
.
Trim
())
{
string
dumpDir
;
assemblyManager
.
DumpAssemblyData
(
out
dumpDir
);
throw
new
ExecutionException
(
expectedOutput
,
actualOutput
,
dumpDir
);
}
return
exitCode
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录