Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
2f555565
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,发现更多精彩内容 >>
提交
2f555565
编写于
3月 11, 2015
作者:
K
Kevin Halverson
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1186 from KevinH-MS/master
Fallback matching for manifest "AssemblyFiles"...
上级
612e507e
50e13e91
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
76 addition
and
35 deletion
+76
-35
src/Compilers/Core/Portable/MetadataReader/MetadataHelpers.cs
...Compilers/Core/Portable/MetadataReader/MetadataHelpers.cs
+0
-1
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/InstructionDecoderTests.cs
...CSharp/Test/ExpressionCompiler/InstructionDecoderTests.cs
+52
-33
src/ExpressionEvaluator/Core/Source/ExpressionCompiler/MetadataUtilities.cs
...uator/Core/Source/ExpressionCompiler/MetadataUtilities.cs
+24
-1
未找到文件。
src/Compilers/Core/Portable/MetadataReader/MetadataHelpers.cs
浏览文件 @
2f555565
...
...
@@ -517,7 +517,6 @@ internal static string UnmangleMetadataNameForArity(string emittedTypeName, int
string
name
)
{
Debug
.
Assert
(
name
!=
null
);
Debug
.
Assert
(
name
.
IndexOf
(
MangledNameRegionStartChar
)
<
0
);
if
(
name
.
Length
==
0
)
{
...
...
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/InstructionDecoderTests.cs
浏览文件 @
2f555565
...
...
@@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator
public
class
InstructionDecoderTests
:
ExpressionCompilerTestBase
{
[
Fact
]
p
rivate
void
GetNameGenerics
()
p
ublic
void
GetNameGenerics
()
{
var
source
=
@"
using System;
...
...
@@ -59,9 +59,9 @@ void M3<U>(Action<U> a)
"Class1<string>.M3<decimal>(System.Action<decimal> a)"
,
GetName
(
source
,
"Class1.M3"
,
DkmVariableInfoFlags
.
Names
|
DkmVariableInfoFlags
.
Types
,
new
[]
{
typeof
(
string
),
typeof
(
decimal
)
}));
}
[
Fact
]
private
void
GetNameNullTypeArguments
()
[
Fact
]
public
void
GetNameNullTypeArguments
()
{
var
source
=
@"
using System;
...
...
@@ -84,9 +84,9 @@ void M<U>(Action<U> a)
"Class1<T>.M<U>(System.Action<U> a)"
,
GetName
(
source
,
"Class1.M"
,
DkmVariableInfoFlags
.
Names
|
DkmVariableInfoFlags
.
Types
,
typeArguments
:
new
[]
{
null
,
typeof
(
decimal
)
}));
}
[
Fact
]
private
void
GetNameGenericArgumentTypeNotInReferences
()
[
Fact
]
public
void
GetNameGenericArgumentTypeNotInReferences
()
{
var
source
=
@"
class Class1
...
...
@@ -98,9 +98,9 @@ class Class1
"System.Collections.Generic.Comparer<Class1>.Create(System.Comparison<Class1> comparison)"
,
GetName
(
source
,
"System.Collections.Generic.Comparer.Create"
,
DkmVariableInfoFlags
.
Names
|
DkmVariableInfoFlags
.
Types
,
typeArguments
:
new
[]
{
serializedTypeArgumentName
}));
}
[
Fact
,
WorkItem
(
1107977
)]
private
void
GetNameGenericAsync
()
[
Fact
,
WorkItem
(
1107977
)]
public
void
GetNameGenericAsync
()
{
var
source
=
@"
using System.Threading.Tasks;
...
...
@@ -117,9 +117,9 @@ static async Task<T> M<T>(T x)
"C.M<System.Exception>(System.Exception x)"
,
GetName
(
source
,
"C.<M>d__0.MoveNext"
,
DkmVariableInfoFlags
.
Names
|
DkmVariableInfoFlags
.
Types
,
new
[]
{
typeof
(
Exception
)
}));
}
[
Fact
]
private
void
GetNameLambda
()
[
Fact
]
public
void
GetNameLambda
()
{
var
source
=
@"
using System;
...
...
@@ -135,9 +135,9 @@ void M()
"C.M.AnonymousMethod__0_0()"
,
GetName
(
source
,
"C.<>c.<M>b__0_0"
,
DkmVariableInfoFlags
.
Names
|
DkmVariableInfoFlags
.
Types
));
}
[
Fact
]
private
void
GetNameGenericLambda
()
[
Fact
]
public
void
GetNameGenericLambda
()
{
var
source
=
@"
using System;
...
...
@@ -153,9 +153,9 @@ class C<T>
"C<System.Exception>.M.AnonymousMethod__0_0(System.ArgumentException u)"
,
GetName
(
source
,
"C.<>c__0.<M>b__0_0"
,
DkmVariableInfoFlags
.
Names
|
DkmVariableInfoFlags
.
Types
,
new
[]
{
typeof
(
Exception
),
typeof
(
ArgumentException
)
}));
}
[
Fact
]
private
void
GetNameProperties
()
[
Fact
]
public
void
GetNameProperties
()
{
var
source
=
@"
class C
...
...
@@ -184,9 +184,9 @@ class C
"C.this[object].set(object x, int value)"
,
GetName
(
source
,
"C.set_Item"
,
DkmVariableInfoFlags
.
Names
|
DkmVariableInfoFlags
.
Types
));
}
[
Fact
]
private
void
GetNameExplicitInterfaceImplementation
()
[
Fact
]
public
void
GetNameExplicitInterfaceImplementation
()
{
var
source
=
@"
using System;
...
...
@@ -199,9 +199,9 @@ class C : IDisposable
"C.System.IDisposable.Dispose()"
,
GetName
(
source
,
"C.System.IDisposable.Dispose"
,
DkmVariableInfoFlags
.
Names
|
DkmVariableInfoFlags
.
Types
));
}
[
Fact
]
private
void
GetNameExtensionMethod
()
[
Fact
]
public
void
GetNameExtensionMethod
()
{
var
source
=
@"
static class Extensions
...
...
@@ -213,9 +213,9 @@ static class Extensions
"Extensions.M(string this)"
,
GetName
(
source
,
"Extensions.M"
,
DkmVariableInfoFlags
.
Names
|
DkmVariableInfoFlags
.
Types
));
}
[
Fact
]
private
void
GetNameArgumentFlagsNone
()
[
Fact
]
public
void
GetNameArgumentFlagsNone
()
{
var
source
=
@"
static class C
...
...
@@ -232,9 +232,9 @@ static class C
"C.M2"
,
GetName
(
source
,
"C.M2"
,
DkmVariableInfoFlags
.
None
));
}
[
Fact
,
WorkItem
(
1107978
)]
private
void
GetNameRefAndOutParameters
()
[
Fact
,
WorkItem
(
1107978
)]
public
void
GetNameRefAndOutParameters
()
{
var
source
=
@"
class C
...
...
@@ -265,9 +265,9 @@ static void M(ref int x, out int y)
"C.M(ref int x, out int y)"
,
GetName
(
source
,
"C.M"
,
DkmVariableInfoFlags
.
Types
|
DkmVariableInfoFlags
.
Names
));
}
[
Fact
]
private
void
GetNameParamsParameters
()
[
Fact
]
public
void
GetNameParamsParameters
()
{
var
source
=
@"
class C
...
...
@@ -281,9 +281,28 @@ static void M(params int[] x)
"C.M(int[] x)"
,
GetName
(
source
,
"C.M"
,
DkmVariableInfoFlags
.
Types
|
DkmVariableInfoFlags
.
Names
));
}
[
Fact
]
private
void
GetReturnTypeNamePrimitive
()
[
Fact
,
WorkItem
(
1134081
,
"DevDiv"
)]
public
void
GetFileNameWithoutExtension
()
{
Assert
.
Equal
(
"."
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"."
));
Assert
.
Equal
(
".a"
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
".a"
));
Assert
.
Equal
(
"a."
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"a."
));
Assert
.
Equal
(
".dll."
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
".dll."
));
Assert
.
Equal
(
"a.b"
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"a.b"
));
Assert
.
Equal
(
"a"
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"a.dll"
));
Assert
.
Equal
(
"a"
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"a.exe"
));
Assert
.
Equal
(
"a"
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"a.netmodule"
));
Assert
.
Equal
(
"a"
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"a.winmd"
));
Assert
.
Equal
(
"a.b.c"
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"a.b.c"
));
Assert
.
Equal
(
"a.b.c"
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"a.b.c.dll"
));
Assert
.
Equal
(
"mscorlib.nlp"
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"mscorlib.nlp"
));
Assert
.
Equal
(
"Microsoft.CodeAnalysis"
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"Microsoft.CodeAnalysis"
));
Assert
.
Equal
(
"Microsoft.CodeAnalysis"
,
MetadataUtilities
.
GetFileNameWithoutExtension
(
"Microsoft.CodeAnalysis.dll"
));
}
[
Fact
]
public
void
GetReturnTypeNamePrimitive
()
{
var
source
=
@"
static class C
...
...
@@ -293,9 +312,9 @@ static class C
Assert
.
Equal
(
"uint"
,
GetReturnTypeName
(
source
,
"C.M1"
));
}
[
Fact
]
private
void
GetReturnTypeNameNested
()
[
Fact
]
public
void
GetReturnTypeNameNested
()
{
var
source
=
@"
static class C
...
...
@@ -314,9 +333,9 @@ internal struct E
Assert
.
Equal
(
"N.D.E"
,
GetReturnTypeName
(
source
,
"C.M1"
));
}
[
Fact
]
private
void
GetReturnTypeNameGenericOfPrimitive
()
[
Fact
]
public
void
GetReturnTypeNameGenericOfPrimitive
()
{
var
source
=
@"
using System;
...
...
@@ -327,9 +346,9 @@ class C
Assert
.
Equal
(
"System.Action<int>"
,
GetReturnTypeName
(
source
,
"C.M1"
));
}
[
Fact
]
private
void
GetReturnTypeNameGenericOfNested
()
[
Fact
]
public
void
GetReturnTypeNameGenericOfNested
()
{
var
source
=
@"
using System;
...
...
@@ -343,9 +362,9 @@ class D
Assert
.
Equal
(
"System.Action<C.D>"
,
GetReturnTypeName
(
source
,
"C.M1"
));
}
[
Fact
]
private
void
GetReturnTypeNameGenericOfGeneric
()
[
Fact
]
public
void
GetReturnTypeNameGenericOfGeneric
()
{
var
source
=
@"
using System;
...
...
src/ExpressionEvaluator/Core/Source/ExpressionCompiler/MetadataUtilities.cs
浏览文件 @
2f555565
...
...
@@ -135,7 +135,12 @@ private static PortableExecutableReference MakeAssemblyMetadata(ModuleMetadata m
// or if the module has not been loaded yet. The value will be null
// if the name was ambiguous.
ModuleMetadata
module
;
if
(
modulesByName
.
TryGetValue
(
name
,
out
module
)
&&
(
module
!=
null
))
if
(!
modulesByName
.
TryGetValue
(
name
,
out
module
))
{
// AssemblyFile names may contain file information (".dll", etc).
modulesByName
.
TryGetValue
(
GetFileNameWithoutExtension
(
name
),
out
module
);
}
if
(
module
!=
null
)
{
builder
.
Add
(
module
);
}
...
...
@@ -151,6 +156,24 @@ private static PortableExecutableReference MakeAssemblyMetadata(ModuleMetadata m
return
assemblyMetadata
.
GetReference
(
embedInteropTypes
:
false
,
display
:
metadata
.
Name
);
}
internal
static
string
GetFileNameWithoutExtension
(
string
fileName
)
{
var
lastDotIndex
=
fileName
.
LastIndexOf
(
'.'
);
if
((
lastDotIndex
>
0
)
&&
(
lastDotIndex
+
1
<
fileName
.
Length
))
{
var
extension
=
fileName
.
Substring
(
lastDotIndex
+
1
);
switch
(
extension
)
{
case
"dll"
:
case
"exe"
:
case
"netmodule"
:
case
"winmd"
:
return
fileName
.
Substring
(
0
,
lastDotIndex
);
}
}
return
fileName
;
}
private
static
PortableExecutableReference
MakeCompileTimeWinMdAssemblyMetadata
(
ArrayBuilder
<
ModuleMetadata
>
runtimeModules
)
{
var
metadata
=
ModuleMetadata
.
CreateFromImage
(
Resources
.
WindowsProxy_winmd
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录