Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2018-01-03 20:06:59 +0300
committerJan Kotas <jkotas@microsoft.com>2018-01-03 20:06:59 +0300
commit55b4a7edef7223cde96ba6d86f9d34524103e4bf (patch)
tree2e743e033207a0d336c36fa7e17d5655fa40e8e9 /src/ILCompiler.MetadataTransform
parente7f7565cd094e0aadc439ce5d6650ef6f5869fbb (diff)
Fix emission of metadata for namespace references (#5189)
We were generating NamespaceReference hierarchy with an extra level of nesting. These are used very rarely, so we didn't notice before.
Diffstat (limited to 'src/ILCompiler.MetadataTransform')
-rw-r--r--src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Namespace.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Namespace.cs b/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Namespace.cs
index 495ef7b78..6573c3b8d 100644
--- a/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Namespace.cs
+++ b/src/ILCompiler.MetadataTransform/src/ILCompiler/Metadata/Transform.Namespace.cs
@@ -72,6 +72,10 @@ namespace ILCompiler.Metadata
private NamespaceReference HandleNamespaceReference(Cts.ModuleDesc parentScope, string namespaceString)
{
+ // The format represents root namespace as a namespace with null name, in contrast with ECMA-335
+ if (namespaceString.Length == 0)
+ namespaceString = null;
+
NamespaceReference result;
NamespaceKey key = new NamespaceKey(parentScope, namespaceString);
if (_namespaceRefs.TryGetValue(key, out result))
@@ -92,6 +96,9 @@ namespace ILCompiler.Metadata
_namespaceRefs.Add(key, rootNamespace);
}
+ if (namespaceString == null)
+ return rootNamespace;
+
NamespaceReference currentNamespace = rootNamespace;
string currentNamespaceName = String.Empty;
foreach (var segment in namespaceString.Split('.'))