using System.Runtime.CompilerServices;
using System.Linq;
using System.Collections.Generic;
+using System.IO;
#if STATIC
using MetaType = IKVM.Reflection.Type;
Constant c = field_type.Kind == MemberKind.MissingType ?
new NullConstant (InternalType.ErrorType, Location.Null) :
CreateConstantFromValue (field_type, fi);
- return new ConstSpec (declaringType, definition, field_type, fi, mod, c);
+ return new ConstSpec (declaringType, definition, field_type, fi, mod | Modifiers.STATIC, c);
}
if ((fa & FieldAttributes.InitOnly) != 0) {
if (field_type.BuiltinType == BuiltinTypeSpec.Type.Decimal) {
var dc = ReadDecimalConstant (CustomAttributeData.GetCustomAttributes (fi));
if (dc != null)
- return new ConstSpec (declaringType, definition, field_type, fi, mod, dc);
+ return new ConstSpec (declaringType, definition, field_type, fi, mod | Modifiers.STATIC, dc);
}
mod |= Modifiers.READONLY;
return found;
}
+ public ImportedAssemblyDefinition GetImportedAssemblyDefinition (AssemblyName assemblyName)
+ {
+ foreach (var a in Assemblies) {
+ var ia = a as ImportedAssemblyDefinition;
+ if (ia == null)
+ continue;
+
+ if (a.Name == assemblyName.Name)
+ return ia;
+ }
+
+ return null;
+ }
+
+
public void ImportTypeBase (MetaType type)
{
TypeSpec spec = import_cache[type];
if (s == null)
continue;
- var an = new AssemblyName (s);
+ AssemblyName an;
+ try {
+ an = new AssemblyName (s);
+ } catch (FileLoadException) {
+ // Invalid assembly name reuses FileLoadException
+ continue;
+ }
+
if (internals_visible_to == null)
internals_visible_to = new List<AssemblyName> ();