- Fixed baseline aligning calcs
[mono.git] / mcs / mbas / codegen.cs
1 //
2 // codegen.cs: The code generator
3 //
4 // Author:
5 //   Miguel de Icaza (miguel@ximian.com)
6 //
7 // (C) 2001 Ximian, Inc.
8 //
9
10 using System;
11 using System.IO;
12 using System.Collections;
13 using System.Reflection;
14 using System.Reflection.Emit;
15 using System.Diagnostics.SymbolStore;
16
17 namespace Mono.MonoBASIC {
18
19         /// <summary>
20         ///    Code generator class.
21         /// </summary>
22         public class CodeGen {
23                 static AppDomain current_domain;
24
25                 public static AssemblyBuilder AssemblyBuilder {
26                         get { 
27                                 return Assembly.Builder;
28                         }                               
29
30                         set {
31                                 Assembly.Builder = value;
32                         }                               
33                 }
34
35                 public static ModuleBuilder ModuleBuilder {
36                         get { 
37                                 return Module.Builder;
38                         }                               
39
40                         set {
41                                 Module.Builder = value;
42                         }                               
43                 }
44
45                 public static AssemblyClass Assembly;
46                 public static ModuleClass Module;
47
48                 static public ISymbolWriter SymbolWriter;
49
50                 static CodeGen ()
51                 {
52                         Assembly = new AssemblyClass ();
53                         Module = new ModuleClass ();
54                 }
55
56                 public static string Basename (string name)
57                 {
58                         int pos = name.LastIndexOf ("/");
59
60                         if (pos != -1)
61                                 return name.Substring (pos + 1);
62
63                         pos = name.LastIndexOf ("\\");
64                         if (pos != -1)
65                                 return name.Substring (pos + 1);
66
67                         return name;
68                 }
69
70                 public static string Dirname (string name)
71                 {
72                         int pos = name.LastIndexOf ("/");
73
74                         if (pos != -1)
75                                 return name.Substring (0, pos);
76
77                         pos = name.LastIndexOf ("\\");
78                         if (pos != -1)
79                                 return name.Substring (0, pos);
80
81                         return ".";
82                 }
83
84                 static string TrimExt (string name)
85                 {
86                         int pos = name.LastIndexOf (".");
87
88                         return name.Substring (0, pos);
89                 }
90
91                 static public string FileName;
92
93                 //
94                 // This routine initializes the Mono runtime SymbolWriter.
95                 //
96                 static bool InitMonoSymbolWriter (string basename, string symbol_output,
97                                                   string exe_output_file, string[] debug_args)
98                 {
99                         Type itype = SymbolWriter.GetType ();
100                         if (itype == null)
101                                 return false;
102
103                         Type[] arg_types = new Type [3];
104                         arg_types [0] = typeof (string);
105                         arg_types [1] = typeof (string);
106                         arg_types [2] = typeof (string[]);
107
108                         MethodInfo initialize = itype.GetMethod ("Initialize", arg_types);
109                         if (initialize == null)
110                                 return false;
111
112                         object[] args = new object [3];
113                         args [0] = exe_output_file;
114                         args [1] = symbol_output;
115                         args [2] = debug_args;
116
117                         initialize.Invoke (SymbolWriter, args);
118                         return true;
119                 }
120
121                 //
122                 // Initializes the symbol writer
123                 //
124                 static void InitializeSymbolWriter (string basename, string symbol_output,
125                                                     string exe_output_file, string[] args)
126                 {
127                         SymbolWriter = ModuleBuilder.GetSymWriter ();
128
129                         //
130                         // If we got an ISymbolWriter instance, initialize it.
131                         //
132                         if (SymbolWriter == null) {
133                                 Report.Warning (
134                                         -18, "Cannot find any symbol writer");
135                                 return;
136                         }
137                         
138                         //
139                         // Due to lacking documentation about the first argument of the
140                         // Initialize method, we cannot use Microsoft's default symbol
141                         // writer yet.
142                         //
143                         // If we're using the mono symbol writer, the SymbolWriter object
144                         // is of type MonoSymbolWriter - but that's defined in a dynamically
145                         // loaded DLL - that's why we're doing a comparision based on the type
146                         // name here instead of using `SymbolWriter is MonoSymbolWriter'.
147                         //
148                         Type sym_type = ((object) SymbolWriter).GetType ();
149                         
150                         switch (sym_type.Name){
151                         case "MonoSymbolWriter":
152                                 if (!InitMonoSymbolWriter (basename, symbol_output,
153                                                            exe_output_file, args))
154                                         Report.Warning (
155                                                 -18, "Cannot initialize the symbol writer");
156                                 break;
157
158                         default:
159                                 Report.Warning (
160                                         -18, "Cannot generate debugging information on this platform");
161                                 break;
162                         }
163                 }
164
165                 //
166                 // Initializes the code generator variables
167                 //
168                 static public void Init (string name, string output, bool want_debugging_support,
169                                          string[] debug_args)
170                 {
171                         AssemblyName an;
172
173                         FileName = output;
174                         an = new AssemblyName ();
175                         an.Name = TrimExt (Basename (name));
176                         current_domain = AppDomain.CurrentDomain;
177                         AssemblyBuilder = current_domain.DefineDynamicAssembly (
178                                 an, AssemblyBuilderAccess.RunAndSave, Dirname (name));
179
180                         //
181                         // Pass a path-less name to DefineDynamicModule.  Wonder how
182                         // this copes with output in different directories then.
183                         // FIXME: figure out how this copes with --output /tmp/blah
184                         //
185                         // If the third argument is true, the ModuleBuilder will dynamically
186                         // load the default symbol writer.
187                         //
188                         ModuleBuilder = AssemblyBuilder.DefineDynamicModule (
189                                 Basename (name), Basename (output), want_debugging_support);
190
191                         int pos = output.LastIndexOf (".");
192
193                         string basename;
194                         if (pos > 0)
195                                 basename = output.Substring (0, pos);
196                         else
197                                 basename = output;
198
199                         string symbol_output = basename + ".dbg";
200
201                         if (want_debugging_support)
202                                 InitializeSymbolWriter (basename, symbol_output, output, debug_args);
203                         else {
204                                 try {
205                                         File.Delete (symbol_output);
206                                 } catch {
207                                         // Ignore errors.
208                                 }
209                         }
210                 }
211
212                 static public void Save (string name)
213                 {
214                         try {
215                                 AssemblyBuilder.Save (Basename (name));
216                         } catch (System.IO.IOException io){
217                                 Report.Error (16, "Coult not write to file `"+name+"', cause: " + io.Message);
218                         }
219                 }
220
221                 static public void SaveSymbols ()
222                 {
223                         if (SymbolWriter != null) {
224                                 // If we have a symbol writer, call its Close() method to write
225                                 // the symbol file to disk.
226                                 //
227                                 // When using Mono's default symbol writer, the Close() method must
228                                 // be called after the assembly has already been written to disk since
229                                 // it opens the assembly and reads its metadata.
230                                 SymbolWriter.Close ();
231                         }
232                 }
233
234                 public static void AddGlobalAttributes (ArrayList attrs)
235                 {
236                         foreach (Attribute attr in attrs) {
237                                 if (attr.IsAssemblyAttribute)
238                                         Assembly.AddAttribute (attr);
239                                 else if (attr.IsModuleAttribute)
240                                         Module.AddAttribute (attr);
241                         }
242                 }
243
244                 public static void EmitGlobalAttributes ()
245                 {
246                         //Assembly.Emit (Tree.Types);
247                         //Module.Emit (Tree.Types);
248
249                 }
250         }
251
252         /// <summary>
253         ///   An Emit Context is created for each body of code (from methods,
254         ///   properties bodies, indexer bodies or constructor bodies)
255         /// </summary>
256         public class EmitContext {
257                 public DeclSpace DeclSpace;
258                 public TypeContainer TypeContainer;
259                 public ILGenerator   ig;
260
261                 /// <summary>
262                 ///   This variable tracks the `checked' state of the compilation,
263                 ///   it controls whether we should generate code that does overflow
264                 ///   checking, or if we generate code that ignores overflows.
265                 ///
266                 ///   The default setting comes from the command line option to generate
267                 ///   checked or unchecked code plus any source code changes using the
268                 ///   checked/unchecked statements or expressions.   Contrast this with
269                 ///   the ConstantCheckState flag.
270                 /// </summary>
271                 
272                 public bool CheckState;
273
274                 /// <summary>
275                 ///   The constant check state is always set to `true' and cant be changed
276                 ///   from the command line.  The source code can change this setting with
277                 ///   the `checked' and `unchecked' statements and expressions. 
278                 /// </summary>
279                 public bool ConstantCheckState;
280
281                 /// <summary>
282                 ///   Whether we are emitting code inside a static or instance method
283                 /// </summary>
284                 public bool IsStatic;
285
286                 /// <summary>
287                 ///   Whether we are emitting a field initializer
288                 /// </summary>
289                 public bool IsFieldInitializer;
290
291                 /// <summary>
292                 ///   The value that is allowed to be returned or NULL if there is no
293                 ///   return type.
294                 /// </summary>
295                 public Type ReturnType;
296
297                 /// <summary>
298                 ///   Points to the Type (extracted from the TypeContainer) that
299                 ///   declares this body of code
300                 /// </summary>
301                 public Type ContainerType;
302                 
303                 /// <summary>
304                 ///   Whether this is generating code for a constructor
305                 /// </summary>
306                 public bool IsConstructor;
307
308                 /// <summary>
309                 ///   Whether we're control flow analysis enabled
310                 /// </summary>
311                 public bool DoFlowAnalysis;
312                 
313                 /// <summary>
314                 ///   Keeps track of the Type to LocalBuilder temporary storage created
315                 ///   to store structures (used to compute the address of the structure
316                 ///   value on structure method invocations)
317                 /// </summary>
318                 public Hashtable temporary_storage;
319
320                 public Block CurrentBlock;
321
322                 /// <summary>
323                 ///   The location where we store the return value.
324                 /// </summary>
325                 LocalBuilder return_value;
326
327                 /// <summary>
328                 ///   The location where return has to jump to return the
329                 ///   value
330                 /// </summary>
331                 public Label ReturnLabel;
332
333                 /// <summary>
334                 ///   If we already defined the ReturnLabel
335                 /// </summary>
336                 public bool HasReturnLabel;
337
338                 /// <summary>
339                 ///   Whether we are in a Finally block
340                 /// </summary>
341                 public bool InFinally;
342
343                 /// <summary>
344                 ///   Whether we are in a Try block
345                 /// </summary>
346                 public bool InTry;
347
348                 /// <summary>
349                 ///   Whether we are in a Catch block
350                 /// </summary>
351                 public bool InCatch;
352
353                 /// <summary>
354                 ///  Whether we are inside an unsafe block
355                 /// </summary>
356                 public bool InUnsafe;
357                 
358                 /// <summary>
359                 ///  Whether we are inside an unsafe block
360                 /// </summary>
361                 public bool InvokingOwnOverload;                
362
363                 /// <summary>
364                 ///   Location for this EmitContext
365                 /// </summary>
366                 public Location loc;
367
368                 /// <summary>
369                 ///   Used to flag that it is ok to define types recursively, as the
370                 ///   expressions are being evaluated as part of the type lookup
371                 ///   during the type resolution process
372                 /// </summary>
373                 public bool ResolvingTypeTree;
374                 
375                 /// <summary>
376                 ///   Inside an enum definition, we do not resolve enumeration values
377                 ///   to their enumerations, but rather to the underlying type/value
378                 ///   This is so EnumVal + EnumValB can be evaluated.
379                 ///
380                 ///   There is no "E operator + (E x, E y)", so during an enum evaluation
381                 ///   we relax the rules
382                 /// </summary>
383                 public bool InEnumContext;
384                 
385                 public string BlockName;
386
387                 protected Stack FlowStack;
388                 
389                 public EmitContext (TypeContainer parent, DeclSpace ds, Location l, ILGenerator ig,
390                                     Type return_type, int code_flags, bool is_constructor)
391                 {
392                         this.ig = ig;
393
394                         TypeContainer = parent;
395                         DeclSpace = ds;
396                         CheckState = RootContext.Checked;
397                         ConstantCheckState = true;
398                         
399                         IsStatic = (code_flags & Modifiers.STATIC) != 0;
400                         ReturnType = return_type;
401                         IsConstructor = is_constructor;
402                         CurrentBlock = null;
403                         BlockName = "";
404                         InvokingOwnOverload = false;
405                         
406                         if (parent != null){
407                                 // Can only be null for the ResolveType contexts.
408                                 ContainerType = parent.TypeBuilder;
409                                 if (parent.UnsafeContext)
410                                         InUnsafe = true;
411                                 else
412                                         InUnsafe = (code_flags & Modifiers.UNSAFE) != 0;
413                         }
414                         loc = l;
415
416                         FlowStack = new Stack ();
417                         
418                         if (ReturnType == TypeManager.void_type)
419                                 ReturnType = null;
420                 }
421
422                 public EmitContext (TypeContainer tc, Location l, ILGenerator ig,
423                                     Type return_type, int code_flags, bool is_constructor)
424                         : this (tc, tc, l, ig, return_type, code_flags, is_constructor)
425                 {
426                 }
427
428                 public EmitContext (TypeContainer tc, Location l, ILGenerator ig,
429                                     Type return_type, int code_flags)
430                         : this (tc, tc, l, ig, return_type, code_flags, false)
431                 {
432                 }
433
434                 public FlowBranching CurrentBranching {
435                         get {
436                                 return (FlowBranching) FlowStack.Peek ();
437                         }
438                 }
439
440                 // <summary>
441                 //   Starts a new code branching.  This inherits the state of all local
442                 //   variables and parameters from the current branching.
443                 // </summary>
444                 public FlowBranching StartFlowBranching (FlowBranchingType type, Location loc)
445                 {
446                         FlowBranching cfb = new FlowBranching (CurrentBranching, type, null, loc);
447
448                         FlowStack.Push (cfb);
449
450                         return cfb;
451                 }
452
453                 // <summary>
454                 //   Starts a new code branching for block `block'.
455                 // </summary>
456                 public FlowBranching StartFlowBranching (Block block)
457                 {
458                         FlowBranching cfb;
459                         FlowBranchingType type;
460
461                         if (CurrentBranching.Type == FlowBranchingType.SWITCH)
462                                 type = FlowBranchingType.SWITCH_SECTION;
463                         else
464                                 type = FlowBranchingType.BLOCK;
465
466                         cfb = new FlowBranching (CurrentBranching, type, block, block.StartLocation);
467
468                         FlowStack.Push (cfb);
469
470                         return cfb;
471                 }
472
473                 // <summary>
474                 //   Ends a code branching.  Merges the state of locals and parameters
475                 //   from all the children of the ending branching.
476                 // </summary>
477                 public FlowReturns EndFlowBranching ()
478                 {
479                         FlowBranching cfb = (FlowBranching) FlowStack.Pop ();
480
481                         return CurrentBranching.MergeChild (cfb);
482                 }
483
484                 // <summary>
485                 //   Kills the current code branching.  This throws away any changed state
486                 //   information and should only be used in case of an error.
487                 // </summary>
488                 public void KillFlowBranching ()
489                 {
490                         FlowBranching cfb = (FlowBranching) FlowStack.Pop ();
491                 }
492
493                 // <summary>
494                 //   Checks whether the local variable `vi' is already initialized
495                 //   at the current point of the method's control flow.
496                 //   If this method returns false, the caller must report an
497                 //   error 165.
498                 // </summary>
499                 public bool IsVariableAssigned (VariableInfo vi)
500                 {
501                         if (DoFlowAnalysis)
502                                 return CurrentBranching.IsVariableAssigned (vi);
503                         else
504                                 return true;
505                 }
506
507                 // <summary>
508                 //   Marks the local variable `vi' as being initialized at the current
509                 //   current point of the method's control flow.
510                 // </summary>
511                 public void SetVariableAssigned (VariableInfo vi)
512                 {
513                         if (DoFlowAnalysis)
514                                 CurrentBranching.SetVariableAssigned (vi);
515                 }
516
517                 // <summary>
518                 //   Checks whether the parameter `number' is already initialized
519                 //   at the current point of the method's control flow.
520                 //   If this method returns false, the caller must report an
521                 //   error 165.  This is only necessary for `out' parameters and the
522                 //   call will always succeed for non-`out' parameters.
523                 // </summary>
524                 public bool IsParameterAssigned (int number)
525                 {
526                         if (DoFlowAnalysis)
527                                 return CurrentBranching.IsParameterAssigned (number);
528                         else
529                                 return true;
530                 }
531
532                 // <summary>
533                 //   Marks the parameter `number' as being initialized at the current
534                 //   current point of the method's control flow.  This is only necessary
535                 //   for `out' parameters.
536                 // </summary>
537                 public void SetParameterAssigned (int number)
538                 {
539                         if (DoFlowAnalysis)
540                                 CurrentBranching.SetParameterAssigned (number);
541                 }
542
543                 // These are two overloaded methods for EmitTopBlock
544                 // since in MonoBasic functions we need the Function name
545                 // along with its top block, in order to be able to
546                 // retrieve the return value when there is no explicit 
547                 // 'Return' statement
548                 public void EmitTopBlock (Block block, InternalParameters ip, Location loc)
549                 {
550                         EmitTopBlock (block, "", ip, loc);
551                 }
552
553                 public void EmitTopBlock (Block block, string bname, InternalParameters ip, Location loc)
554                 {
555                         bool has_ret = false;
556
557                         //Console.WriteLine ("Emitting: '{0}", bname);
558                         BlockName = bname;
559                         if (CodeGen.SymbolWriter != null)
560                                 Mark (loc);
561
562                         if (block != null){
563                                 int errors = Report.Errors;
564
565                                 block.EmitMeta (this, block);
566
567                                 if (Report.Errors == errors){
568                                         bool old_do_flow_analysis = DoFlowAnalysis;
569                                         DoFlowAnalysis = true;
570
571                                         FlowBranching cfb = new FlowBranching (block, ip, loc);
572                                         FlowStack.Push (cfb);
573
574                                         if (!block.Resolve (this)) {
575                                                 FlowStack.Pop ();
576                                                 DoFlowAnalysis = old_do_flow_analysis;
577                                                 return;
578                                         }
579
580                                         cfb = (FlowBranching) FlowStack.Pop ();
581                                         FlowReturns returns = cfb.MergeTopBlock ();
582
583                                         DoFlowAnalysis = old_do_flow_analysis;
584
585                                         has_ret = block.Emit (this);
586
587                                         if ((returns == FlowReturns.ALWAYS) ||
588                                             (returns == FlowReturns.EXCEPTION) ||
589                                             (returns == FlowReturns.UNREACHABLE))
590                                                 has_ret = true;
591
592                                         if (Report.Errors == errors){
593                                                 if (RootContext.WarningLevel >= 3)
594                                                         block.UsageWarning ();
595                                         }
596                                 }
597                         }
598
599                         if (ReturnType != null && !has_ret){
600                                 //
601                                 // mcs here would report an error (and justly so), but functions without
602                                 // an explicit return value are perfectly legal in MonoBasic
603                                 //
604                                 
605                                 VariableInfo vi = block.GetVariableInfo (bname);
606                                 if (vi != null) 
607                                 {
608                                         ig.Emit (OpCodes.Ldloc, vi.LocalBuilder);
609                                         ig.Emit (OpCodes.Ret);
610                                 }
611                                 else
612                                         Report.Error (-200, "This is not supposed to happen !");
613                                 return;
614                         }
615
616                         if (HasReturnLabel)
617                                 ig.MarkLabel (ReturnLabel);
618                         if (return_value != null){
619                                 ig.Emit (OpCodes.Ldloc, return_value);
620                                 ig.Emit (OpCodes.Ret);
621                         } else {
622                                 if (!InTry){
623                                         if (!has_ret || HasReturnLabel)
624                                                 ig.Emit (OpCodes.Ret);
625                                 }
626                         }
627                 }
628
629                 /// <summary>
630                 ///   This is called immediately before emitting an IL opcode to tell the symbol
631                 ///   writer to which source line this opcode belongs.
632                 /// </summary>
633                 public void Mark (Location loc)
634                 {
635                         if ((CodeGen.SymbolWriter != null) && !Location.IsNull (loc)) {
636                                 ISymbolDocumentWriter doc = loc.SymbolDocument;
637
638                                 if (doc != null)
639                                         ig.MarkSequencePoint (doc, loc.Row, 0,  loc.Row, 0);
640                         }
641                 }
642
643                 /// <summary>
644                 ///   Returns a temporary storage for a variable of type t as 
645                 ///   a local variable in the current body.
646                 /// </summary>
647                 public LocalBuilder GetTemporaryStorage (Type t)
648                 {
649                         LocalBuilder location;
650                         
651                         if (temporary_storage != null){
652                                 location = (LocalBuilder) temporary_storage [t];
653                                 if (location != null)
654                                         return location;
655                         }
656                         
657                         location = ig.DeclareLocal (t);
658                         
659                         return location;
660                 }
661
662                 public void FreeTemporaryStorage (LocalBuilder b)
663                 {
664                         // Empty for now.
665                 }
666
667                 /// <summary>
668                 ///   Current loop begin and end labels.
669                 /// </summary>
670                 public Label LoopBegin, LoopEnd;
671
672                 /// <summary>
673                 ///   Whether we are inside a loop and break/continue are possible.
674                 /// </summary>
675                 public bool  InLoop;
676
677                 /// <summary>
678                 ///   This is incremented each time we enter a try/catch block and
679                 ///   decremented if we leave it.
680                 /// </summary>
681                 public int   TryCatchLevel;
682
683                 /// <summary>
684                 ///   The TryCatchLevel at the begin of the current loop.
685                 /// </summary>
686                 public int   LoopBeginTryCatchLevel;
687
688                 /// <summary>
689                 ///   Default target in a switch statement.   Only valid if
690                 ///   InSwitch is true
691                 /// </summary>
692                 public Label DefaultTarget;
693
694                 /// <summary>
695                 ///   If this is non-null, points to the current switch statement
696                 /// </summary>
697                 public Switch Switch;
698
699                 /// <summary>
700                 ///   ReturnValue creates on demand the LocalBuilder for the
701                 ///   return value from the function.  By default this is not
702                 ///   used.  This is only required when returns are found inside
703                 ///   Try or Catch statements.
704                 /// </summary>
705                 public LocalBuilder TemporaryReturn ()
706                 {
707                         if (return_value == null){
708                                 return_value = ig.DeclareLocal (ReturnType);
709                                 ReturnLabel = ig.DefineLabel ();
710                                 HasReturnLabel = true;
711                         }
712
713                         return return_value;
714                 }
715
716                 /// <summary>
717                 ///   A dynamic This that is shared by all variables in a emitcontext.
718                 ///   Created on demand.
719                 /// </summary>
720                 public Expression my_this;
721                 public Expression This {
722                         get {
723                                 if (my_this == null) {
724                                         if (CurrentBlock != null)
725                                                 my_this = new This (CurrentBlock, loc);
726                                         else
727                                                 my_this = new This (loc);
728
729                                         my_this = my_this.Resolve (this);
730                                 }
731
732                                 return my_this;
733                         }
734                 }
735         }
736
737         
738         public abstract class CommonAssemblyModulClass: Attributable {
739                 protected CommonAssemblyModulClass ():
740                         base (null)
741                 {
742                 }
743
744                 public void AddAttribute (Attribute attr)
745                 {
746                         if (OptAttributes == null) {
747                                 OptAttributes = new Attributes (attr);
748                         } else {
749                                 OptAttributes.Add (attr);
750                         }
751                 }
752
753                 public virtual void Emit (TypeContainer tc) 
754                 {
755                         if (OptAttributes == null)
756                                 return;
757                         EmitContext ec = new EmitContext (tc, Location.Null, null, null, 0, false);
758
759                         if (OptAttributes != null)
760                                 OptAttributes.Emit (ec, this);
761                 }
762                 
763                 
764         }
765
766         public class AssemblyClass: CommonAssemblyModulClass 
767         {
768                 public AssemblyBuilder Builder;
769
770                 public override AttributeTargets AttributeTargets {
771                         get {
772                                 return AttributeTargets.Assembly;
773                         }
774                 }
775                 
776                 public override void Emit (TypeContainer tc)
777                 {
778                         base.Emit (tc);
779                 }
780
781                 public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder customBuilder)
782                 {
783                         Builder.SetCustomAttribute (customBuilder);
784                 }
785
786         }
787         
788         public class ModuleClass: CommonAssemblyModulClass 
789         {
790                 public ModuleBuilder Builder;
791
792                 public ModuleClass ()
793                 {
794                 }
795
796                 public override void Emit (TypeContainer tc)
797                 {
798                         base.Emit (tc);
799                 }
800         
801                 public override AttributeTargets AttributeTargets {
802                         get {
803                                 return AttributeTargets.Module;
804                         }
805                 }
806
807                 public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder customBuilder)
808                 {
809                         Builder.SetCustomAttribute (customBuilder);
810                 }
811         }
812 }