Ejemplo n.º 1
0
    public Method AddSet(InputElement id)
    {
        ClassType c = (ClassType)declSpace.Owner;

        set = c.AddMethod(new InputElement(mangle(id.str, "set_"), id.coord), null);
        set.AddFormal(new InputElement("value", id.coord), null);
        return(set);
    }
Ejemplo n.º 2
0
 Method GetMethod(Method m, MetaDataMethod x, string path)
 {
     m.Modifiers = GetMethodModifiers(x);
     m.Type      = GetType(x.Signature.ReturnType, path);
     for (int i = 0; i < x.Parameters.Length; i++)
     {
         Formal        f;
         MetaDataParam p = x.Parameters[i];
         if (i == x.Parameters.Length - 1 && m.Name == "set_Item")
         {
             f = m.AddFormal(new InputElement("value"), msg);
             m.signature.formals.Remove(f);
         }
         else
         {
             f = m.AddFormal(new InputElement(String.Format("arg{0}", i + 1)), msg);
         }
         f.Type = GetType(x.Signature.Parameters[i].Type, path);
         if ((p.Flags & ((int)MetaDataParam.ParamAttributes.Out)) != 0)
         {
             f.modifier = new InputElement("out");
         }
         else if (f.Type is ManagedPointerType)
         {
             f.modifier = new InputElement("ref");
         }
         if (f.Type is ManagedPointerType)
         {
             f.Type = ((ManagedPointerType)f.Type).elementType;
         }
         else if (p.CustomAttributes != null)
         {
             foreach (MetaDataCustomAttribute a in p.CustomAttributes)
             {
                 MetaDataMethod t = a.Type as MetaDataMethod;
                 if (t != null && t.Parent != null && t.Parent.Name == "ParamArrayAttribute")
                 {
                     f.IsParams = true;
                     break;
                 }
             }
         }
     }
     return(m);
 }
Ejemplo n.º 3
0
    public Event(InputElement id, SymbolTable declSpace) : base(id, declSpace)
    {
        ClassType c = (ClassType)declSpace.Owner;

        add = c.AddMethod(new InputElement(mangle(id.str, "add_"), id.coord), null);
        add.AddFormal(new InputElement("value", id.coord), null);
        remove = c.AddMethod(new InputElement(mangle(id.str, "remove_"), id.coord), null);
        remove.AddFormal(new InputElement("value", id.coord), null);
    }
Ejemplo n.º 4
0
    Method GetMethod(Method m, MethodBase info)
    {
        m.Modifiers = GetMethodModifiers(info);
        if (info is MethodInfo)
        {
            m.Type = GetType(((MethodInfo)info).ReturnType);
        }
        else
        {
            m.Type = global.Types.Void;
        }
        Formal f = null;

        foreach (ParameterInfo x in info.GetParameters())
        {
            f      = m.AddFormal(new InputElement(x.Name), msg);
            f.Type = GetType(x.ParameterType);
            if (x.IsOut)
            {
                f.modifier = new InputElement("out");
            }
            else if (f.Type is ManagedPointerType)
            {
                f.modifier = new InputElement("ref");
            }
            if (f.Type is ManagedPointerType)
            {
                f.Type = ((ManagedPointerType)f.Type).elementType;
            }
            else
            {
                object[] attrs = x.GetCustomAttributes(paramArrayType, false);
                if (attrs.Length > 0)
                {
                    Debug.Assert(attrs.Length == 1);
                    f.IsParams = true;
                }
            }
        }
        if (f != null && m.Name == "set_Item")
        {
            m.signature.formals.Remove(f);
        }
        return(m);
    }
Ejemplo n.º 5
0
 public Formal AddFormal(InputElement id, MessageWriter msg)
 {
     return(invoke.AddFormal(id, msg));
 }