Example #1
0
 /// <summary>
 /// loads the TypeBuilder which was creted during class definition.
 /// </summary>
 /// <param name="t">T.</param>
 public void ImplementMethod(Coco.Token t)
 {
     mb = cb.GetMethodBuilder(t.val.ToUpper());
     if (mb == null)
     {
         throw new CompilerError("unkown method " + t.val);
     }
     else
     {
         il = mb.GetILGenerator();
     }
 }
Example #2
0
        /// <summary>
        /// creates a MethodBuilder and stores is in this.mbList
        /// </summary>
        /// <param name="t">T.</param>
        public void DefineMethod(Coco.Token t, bool isStatic)
        {
            MethodAttributes attr = 0;

            switch (this.CurrentVisibility)
            {
            case Visibility.publ: attr = MethodAttributes.Public;  break;

            case Visibility.prot: attr = MethodAttributes.Family;  break;

            case Visibility.priv: attr = MethodAttributes.Private; break;
            }
            if (isStatic)
            {
                attr = attr | MethodAttributes.Static;
            }
            mb = cb.DefineMethod(t.val.ToUpper(), attr);
        }
Example #3
0
 /// <summary>
 /// at end the end of a method implementation we mus emit a RET command
 /// </summary>
 /// <param name="t">T.</param>
 public void EndMethod(Coco.Token t)
 {
     il.Emit(OpCodes.Ret);
 }
Example #4
0
 public ExecutableCommand(Coco.Token t)
     : base(t)
 {
 }