public ExternTypeRef GetTypeRef(string asmb_name, string full_name, bool is_valuetype) { ExternAssembly ext_asmb = null; if (assembly_table == null && (asmb_name == "mscorlib" || asmb_name == "corlib")) { /* AddCorlib if mscorlib is being referenced but * we haven't encountered a ".assembly 'name'" as yet. */ Report.Warning(String.Format("Reference to undeclared extern assembly '{0}', adding.", asmb_name)); AddCorlib(); } if (assembly_table != null) { ext_asmb = assembly_table[asmb_name] as ExternAssembly; } if (ext_asmb == null) { System.Reflection.AssemblyName asmname = new System.Reflection.AssemblyName(); asmname.Name = asmb_name; Report.Warning(String.Format("Reference to undeclared extern assembly '{0}', adding.", asmb_name)); ext_asmb = AddAssembly(asmb_name, asmname, 0); } return(ext_asmb.GetTypeRef(full_name, is_valuetype)); }
public bool IsSuppressUnmanaged(CodeGen codegen) { string asmname = ""; BaseTypeRef owner = method_ref.Owner; if (owner == null) { return(false); } ExternTypeRef etr = owner as ExternTypeRef; if (etr != null) { ExternAssembly ea = etr.ExternRef as ExternAssembly; if (ea != null) { asmname = ea.Name; } } return(owner.FullName == "System.Security.SuppressUnmanagedCodeSecurityAttribute" && (asmname == "mscorlib" || codegen.IsThisAssembly("mscorlib"))); }
public ExternAssembly GetAssemblyRef(string assembly_name) { ExternAssembly ass = null; if (assembly_table != null) { ass = assembly_table [assembly_name] as ExternAssembly; } if (ass == null) { Report.Error("Assembly " + assembly_name + " is not defined."); } return(ass); }
public System.Type GetReflectedType() { ExternRef er = extern_ref as ExternRef; if (er != null) { ExternAssembly ea = er as ExternAssembly; if (ea != null) { System.Reflection.Assembly asm = System.Reflection.Assembly.Load(ea.Name); //Type name required here, so don't use FullName return(asm.GetType(Name)); } /* else ExternModule */ } /*else - nested type? */ return(null); }
public PEAPI.Permission Resolve(CodeGen code_gen) { string fname; type_ref.Resolve(code_gen); if (type_ref is ExternTypeRef) { ExternAssembly ea = ((ExternTypeRef)type_ref).ExternRef as ExternAssembly; if (ea == null) { //FIXME: module.. ? throw new NotImplementedException(); } string name; ExternTypeRef etr = type_ref as ExternTypeRef; if (etr != null) { name = etr.Name; } else { name = type_ref.FullName; } fname = String.Format("{0}, {1}", name, ea.AssemblyName.FullName); } else { fname = type_ref.FullName; } perm = new PEAPI.Permission(type_ref.PeapiType, fname); foreach (PermissionMember member in members) { perm.AddMember(member.Resolve(code_gen)); } return(perm); }
public ExternAssembly AddAssembly(string name, AssemblyName asmb_name, PEAPI.AssemAttr attr) { ExternAssembly ea = null; if (assembly_table == null) { assembly_table = new Hashtable(); } else { ea = assembly_table [name] as ExternAssembly; if (ea != null) { return(ea); } } ea = new ExternAssembly(name, asmb_name, attr); assembly_table [name] = ea; return(ea); }
public ExternAssembly AddAssembly (string name, AssemblyName asmb_name, PEAPI.AssemAttr attr) { ExternAssembly ea = null; if (assembly_table == null) { assembly_table = new Hashtable (); } else { ea = assembly_table [name] as ExternAssembly; if (ea != null) return ea; } ea = new ExternAssembly (name, asmb_name, attr); assembly_table [name] = ea; return ea; }
public void EndAssemblyRef () { current_assemblyref = null; current_customattrtarget = null; current_declsectarget = null; }
public void BeginAssemblyRef (string name, AssemblyName asmb_name, PEAPI.AssemAttr attr) { current_customattrtarget = current_assemblyref = ExternTable.AddAssembly (name, asmb_name, attr); current_declsectarget = current_assemblyref; }
public void EndAssemblyRef() { current_assemblyref = null; current_customattrtarget = null; current_declsectarget = null; }
public void BeginAssemblyRef(string name, AssemblyName asmb_name, PEAPI.AssemAttr attr) { current_customattrtarget = current_assemblyref = ExternTable.AddAssembly(name, asmb_name, attr); current_declsectarget = current_assemblyref; }