diff --git a/src/XamlX.IL.Cecil/XamlX.IL.Cecil.csproj b/src/XamlX.IL.Cecil/XamlX.IL.Cecil.csproj
index 92949f34..d4af3ff7 100644
--- a/src/XamlX.IL.Cecil/XamlX.IL.Cecil.csproj
+++ b/src/XamlX.IL.Cecil/XamlX.IL.Cecil.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/src/XamlX/IL/SreTypeSystem.cs b/src/XamlX/IL/SreTypeSystem.cs
index 70404608..ff19e0d9 100644
--- a/src/XamlX/IL/SreTypeSystem.cs
+++ b/src/XamlX/IL/SreTypeSystem.cs
@@ -16,7 +16,7 @@ class SreTypeSystem : IXamlTypeSystem
{
private List _assemblies = new List();
public IReadOnlyList Assemblies => _assemblies;
-
+
private Dictionary _typeDic = new Dictionary();
public SreTypeSystem()
@@ -34,7 +34,7 @@ public SreTypeSystem()
//
}
}
-
+
public IXamlAssembly FindAssembly(string name)
{
return Assemblies.FirstOrDefault(a => a.Name.ToLowerInvariant() == name.ToLowerInvariant());
@@ -98,7 +98,7 @@ public SreAssembly(SreTypeSystem system, Assembly asm)
public bool Equals(IXamlAssembly other) => Assembly == ((SreAssembly) other)?.Assembly;
public string Name => Assembly.GetName().Name;
-
+
public IReadOnlyList Types { get; private set; }
private Dictionary _typeDic = new Dictionary();
@@ -115,7 +115,11 @@ public IXamlType FindType(string fullName)
public void Init()
{
- var types = Assembly.GetExportedTypes().Select(t => _system.ResolveType(t)).ToList();
+ // PYREX NOTE: GetTypes() is not exactly right -- we want GetExportedTypes if the assembly is not friendly to us
+ // and _specifically_ the internal and visible types if the assembly is
+ //
+ // However, this is the hack I gave Dr. Smugleaf
+ var types = Assembly.GetTypes().Select(t => _system.ResolveType(t)).ToList();
Types = types;
_typeDic = types.ToDictionary(t => t.Type.FullName);
}
@@ -138,7 +142,7 @@ public IReadOnlyList CustomAttributes
(_customAttributes = _member.GetCustomAttributesData().Select(a => new SreCustomAttribute(System,
a, System.ResolveType(a.AttributeType))).ToList());
}
-
+
[DebuggerDisplay("{" + nameof(Type) + "}")]
class SreType : SreMemberInfo, IXamlType
{
@@ -272,7 +276,7 @@ public SreCustomAttribute(SreTypeSystem system, CustomAttributeData data, IXamlT
Properties = data.NamedArguments?.ToDictionary(x => x.MemberName, x => x.TypedValue.Value) ??
new Dictionary();
}
-
+
public bool Equals(IXamlCustomAttribute other)
{
return ((SreCustomAttribute) other)?._data.Equals(_data) == true;
@@ -301,7 +305,7 @@ public SreMethodBase(SreTypeSystem system, MethodBase method) : base(system, met
public override string ToString() => _method.DeclaringType?.FullName + " " + _method;
}
-
+
[DebuggerDisplay("{Method}")]
class SreMethod : SreMethodBase, IXamlMethod
{
@@ -333,7 +337,7 @@ public SreConstructor(SreTypeSystem system, ConstructorInfo ctor) : base(system,
Constuctor = ctor;
}
- public bool Equals(IXamlConstructor other)
+ public bool Equals(IXamlConstructor other)
=> ((SreConstructor) other)?.Constuctor.Equals(Constuctor) == true;
}
@@ -381,7 +385,7 @@ public SreEvent(SreTypeSystem system, EventInfo ev) : base(system, ev)
public bool Equals(IXamlEventInfo other) => (other as SreEvent)?.Event.Equals(Event) == true;
public override string ToString() => Event.ToString();
}
-
+
class SreField : SreMemberInfo, IXamlField
{
public FieldInfo Field { get; }
@@ -464,13 +468,13 @@ public IXamlILEmitter Emit(OpCode code, long arg)
_ilg.Emit(code, arg);
return this;
}
-
+
public IXamlILEmitter Emit(OpCode code, float arg)
{
_ilg.Emit(code, arg);
return this;
}
-
+
public IXamlILEmitter Emit(OpCode code, double arg)
{
_ilg.Emit(code, arg);
@@ -517,8 +521,8 @@ public IXamlILEmitter Emit(OpCode code, IXamlType type)
_ilg.Emit(code, ((SreType) type).Type);
return this;
}
-
-
+
+
public IXamlILEmitter Emit(OpCode code, IXamlField field)
{
_ilg.Emit(code, ((SreField) field).Field);
@@ -534,7 +538,7 @@ public SreLabel(Label label)
Label = label;
}
}
-
+
class SreLocal : IXamlLocal
{
public LocalBuilder Local { get; }
@@ -556,7 +560,7 @@ public SreTypeBuilder(SreTypeSystem system, TypeBuilder tb) : base(system,null,
_system = system;
_tb = tb;
}
-
+
public IXamlField DefineField(IXamlType type, string name, bool isPublic, bool isStatic)
{
var f = _tb.DefineField(name, ((SreType) type).Type,
@@ -589,7 +593,7 @@ public void EmitClosure(IEnumerable fields)
throw new NotImplementedException();
}
}
-
+
public IXamlMethodBuilder DefineMethod(IXamlType returnType, IEnumerable args, string name,
bool isPublic, bool isStatic,
bool isInterfaceImpl, IXamlMethod overrideMethod)
@@ -597,7 +601,7 @@ public IXamlMethodBuilder DefineMethod(IXamlType returnType, IEn
var ret = ((SreType) returnType).Type;
var largs = (IReadOnlyList)(args?.ToList()) ?? Array.Empty();
var argTypes = largs.Cast().Select(t => t.Type);
- var m = _tb.DefineMethod(name,
+ var m = _tb.DefineMethod(name,
(isPublic ? MethodAttributes.Public : MethodAttributes.Private)
|(isStatic ? MethodAttributes.Static : default(MethodAttributes))
|(isInterfaceImpl ? MethodAttributes.Virtual|MethodAttributes.NewSlot : default(MethodAttributes))
@@ -628,7 +632,7 @@ public SreConstructorBuilder(SreTypeSystem system, ConstructorBuilder ctor) : ba
public IXamlILEmitter Generator { get; }
}
-
+
public IXamlConstructorBuilder DefineConstructor(bool isStatic, params IXamlType[] args)
{
var attrs = MethodAttributes.Public;
@@ -639,7 +643,7 @@ public IXamlConstructorBuilder DefineConstructor(bool isStatic,
args.Cast().Select(t => t.Type).ToArray());
return new SreConstructorBuilder(_system, ctor);
}
-
+
public IXamlType CreateType() => new SreType(_system, null, _tb.CreateTypeInfo());
public IXamlTypeBuilder DefineSubType(IXamlType baseType, string name, bool isPublic)
{
@@ -648,10 +652,10 @@ public IXamlTypeBuilder DefineSubType(IXamlType baseType, string
attrs |= TypeAttributes.NestedPublic;
else
attrs |= TypeAttributes.NestedPrivate;
-
+
var builder = _tb.DefineNestedType(name, attrs,
((SreType) baseType).Type);
-
+
return new SreTypeBuilder(_system, builder);
}