public static AssemblyClass Assembly;
public static ModuleClass Module;
+ public static ArrayList ArrListVersion = new ArrayList();//keeps the version's 4 numbers
static public ISymbolWriter SymbolWriter;
an = new AssemblyName ();
an.Name = TrimExt (Basename (name));
current_domain = AppDomain.CurrentDomain;
+
+ if (ArrListVersion.Count < 4)//4 -> Major, Minor,Version, Build
+ for(int i=ArrListVersion.Count-1;i<4;i++)
+ ArrListVersion.Add(0);
+ an.Version = new Version (Convert.ToInt32(ArrListVersion[0]), Convert.ToInt32(ArrListVersion[1]), Convert.ToInt32(ArrListVersion[2]), Convert.ToInt32(ArrListVersion[3]));
+
AssemblyBuilder = current_domain.DefineDynamicAssembly (
an, AssemblyBuilderAccess.RunAndSave, Dirname (name));
// If the third argument is true, the ModuleBuilder will dynamically
// load the default symbol writer.
//
+
ModuleBuilder = AssemblyBuilder.DefineDynamicModule (
Basename (name), Basename (output), want_debugging_support);
{
foreach (Attribute attr in attrs) {
if (attr.IsAssemblyAttribute)
+ {
Assembly.AddAttribute (attr);
+ }
else if (attr.IsModuleAttribute)
+ {
Module.AddAttribute (attr);
+ }
}
}
{
//Assembly.Emit (Tree.Types);
//Module.Emit (Tree.Types);
+
}
}
/// properties bodies, indexer bodies or constructor bodies)
/// </summary>
public class EmitContext {
+
public DeclSpace DeclSpace;
public TypeContainer TypeContainer;
public ILGenerator ig;
+
/// <summary>
/// This variable tracks the `checked' state of the compilation,
/// </summary>
public bool HasReturnLabel;
+ /// <summary>
+ /// The location where to exit
+ /// </summary>
+ public Label ExitLabel;
+
+ /// <summary>
+ /// If we already defined the ExitLabel
+ /// </summary>
+ public bool HasExitLabel;
+
/// <summary>
/// Whether we are in a Finally block
/// </summary>
Type return_type, int code_flags, bool is_constructor)
{
this.ig = ig;
-
TypeContainer = parent;
DeclSpace = ds;
CheckState = RootContext.Checked;
}
}
+ if (HasReturnLabel)
+ ig.MarkLabel (ReturnLabel);
+ if (return_value != null){
+ ig.Emit (OpCodes.Ldloc, return_value);
+ ig.Emit (OpCodes.Ret);
+ return;
+ }
+
if (ReturnType != null && !has_ret){
//
// mcs here would report an error (and justly so), but functions without
return;
}
- if (HasReturnLabel)
- ig.MarkLabel (ReturnLabel);
- if (return_value != null){
- ig.Emit (OpCodes.Ldloc, return_value);
- ig.Emit (OpCodes.Ret);
- } else {
- if (!InTry){
- if (!has_ret || HasReturnLabel)
- ig.Emit (OpCodes.Ret);
- }
+ if (!InTry){
+ if (!has_ret)
+ ig.Emit (OpCodes.Ret);
+ else if (ReturnType == null)
+ ig.Emit (OpCodes.Ret);
}
}
{
if (OptAttributes == null)
return;
- EmitContext ec = new EmitContext (tc, Location.Null, null, null, 0, false);
-
+ EmitContext ec = new EmitContext (tc, Location.Null, null, null, 0, false);
+
if (OptAttributes != null)
OptAttributes.Emit (ec, this);
}
public override void Emit (TypeContainer tc)
{
- base.Emit (tc);
+ base.Emit (tc);
}
public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder customBuilder)
}
}
}
+
+