//
public static Hashtable AllDefines = new Hashtable ();
- //
- // The list of global attributes (those that target the assembly)
- //
- static Hashtable global_attributes = new Hashtable ();
-
//
// Whether we are being linked against the standard libraries.
// This is only used to tell whether `System.Object' should
public static int WarningLevel = 2;
+ public static Target Target = Target.Exe;
+ public static string TargetExt = ".exe";
+
//
// If set, enable C# version 2 features
//
type_container_resolve_order = new ArrayList ();
}
+ public static bool NeedsEntryPoint {
+ get {
+ return RootContext.Target == Target.Exe || RootContext.Target == Target.WinExe;
+ }
+ }
+
static public Tree Tree {
get {
return tree;
{
TypeContainer root = Tree.Types;
- ArrayList ifaces = root.Interfaces;
-
if (root.Enums != null)
foreach (Enum en in root.Enums)
en.CloseType ();
foreach (TypeBuilder type_builder in helper_classes)
type_builder.CreateType ();
}
+
+ attribute_types = null;
+ interface_resolve_order = null;
+ type_container_resolve_order = null;
+ helper_classes = null;
+ tree = null;
+ TypeManager.CleanUp ();
}
/// <summary>
static Type NamespaceLookup (DeclSpace ds, string name, Location loc)
{
- Type t;
-
//
// Try in the current namespace and all its implicit parents
//
// Because of the strange way in which we do things, global
// attributes must be processed first.
//
- if (global_attributes.Count > 0){
- AssemblyBuilder ab = CodeGen.AssemblyBuilder;
- TypeContainer dummy = new TypeContainer (null, null, "", new Location (-1));
- EmitContext temp_ec = new EmitContext (
- dummy, Mono.CSharp.Location.Null, null, null, 0, false);
-
- foreach (DictionaryEntry de in global_attributes){
- NamespaceEntry ns = (NamespaceEntry) de.Key;
- Attributes attrs = (Attributes) de.Value;
-
- dummy.NamespaceEntry = ns;
- Attribute.ApplyAttributes (temp_ec, ab, ab, attrs);
- }
- }
+ CodeGen.Assembly.Emit ();
+ CodeGen.Module.Emit ();
if (attribute_types != null)
foreach (TypeContainer tc in attribute_types)
if (EmitCodeHook != null)
EmitCodeHook ();
-
-
- if (Unsafe) {
- if (TypeManager.unverifiable_code_ctor == null) {
- Console.WriteLine ("Internal error ! Cannot set unverifiable code attribute.");
- return;
- }
-
- CustomAttributeBuilder cb = new CustomAttributeBuilder (TypeManager.unverifiable_code_ctor,
- new object [0]);
- CodeGen.ModuleBuilder.SetCustomAttribute (cb);
- }
}
//
static public FieldBuilder MakeStaticData (byte [] data)
{
FieldBuilder fb;
- int size = data.Length;
if (impl_details_class == null){
- impl_details_class = CodeGen.ModuleBuilder.DefineType (
+ impl_details_class = CodeGen.Module.Builder.DefineType (
"<PrivateImplementationDetails>",
TypeAttributes.NotPublic,
TypeManager.object_type);
return fb;
}
-
- //
- // Adds a global attribute that was declared in `container',
- // the attribute is in `attr', and it was defined at `loc'
- //
- static public void AddGlobalAttributeSection (TypeContainer container, AttributeSection attr)
- {
- NamespaceEntry ns = container.NamespaceEntry;
- Attributes a = (Attributes) global_attributes [ns];
-
- if (a == null)
- global_attributes [ns] = new Attributes (attr);
- else
- a.AddAttributeSection (attr);
- }
}
}