Fix namespaces being stripped from assembly imports

This commit is contained in:
Yoshi Askharoun
2024-02-10 21:38:37 -06:00
parent 97001fbd29
commit 24866a81bd
+10 -7
View File
@@ -39,15 +39,15 @@ public class Disassembler
var propOffset = markupTypeSchema.InitializePropertiesOffset; var propOffset = markupTypeSchema.InitializePropertiesOffset;
if (propOffset != uint.MaxValue) if (propOffset != uint.MaxValue)
InsertLabel(propOffset, ExportDirective.GetInitializePropertiesLabel(labelPrefix)); InsertLabel(propOffset, ExportDirective.GetInitializePropertiesLabel(labelPrefix));
var loclOffset = markupTypeSchema.InitializeLocalsInputOffset; var loclOffset = markupTypeSchema.InitializeLocalsInputOffset;
if (loclOffset != uint.MaxValue) if (loclOffset != uint.MaxValue)
InsertLabel(loclOffset, ExportDirective.GetInitializeLocalsInputLabel(labelPrefix)); InsertLabel(loclOffset, ExportDirective.GetInitializeLocalsInputLabel(labelPrefix));
var contOffset = markupTypeSchema.InitializeContentOffset; var contOffset = markupTypeSchema.InitializeContentOffset;
if (contOffset != uint.MaxValue) if (contOffset != uint.MaxValue)
InsertLabel(contOffset, ExportDirective.GetInitializeContentLabel(labelPrefix)); InsertLabel(contOffset, ExportDirective.GetInitializeContentLabel(labelPrefix));
if (markupTypeSchema.InitialEvaluateOffsets != null) if (markupTypeSchema.InitialEvaluateOffsets != null)
{ {
@@ -100,11 +100,14 @@ public class Disassembler
var scheme = uri[..schemeLength]; var scheme = uri[..schemeLength];
if (scheme == "assembly") if (scheme == "assembly")
{ {
// Assume the URI represents a C# namespace // Assume 'host' is an assembly name and path represents a C# namespace
namespacePrefix = uri.Split('.', '/', '\\', '!')[^1]; var assemblyUriParts = uri.Split('/');
// Remove the extra assembly info var importedNamespace = assemblyUriParts[^1];
uri = uri.Split(',')[0]; namespacePrefix = importedNamespace.Split('.', '/', '\\', '!')[^1];
System.Reflection.AssemblyName assemblyName = new(assemblyUriParts[^2]);
uri = $"{scheme}://{assemblyName.Name}/{importedNamespace}";
} }
else else
{ {