Beispiel #1
0
 private Class GetTheRealType(NCC.MType objectType, DefaultCompilationUnit cu)
 {
     if (objectType is NCC.MType.Class)
     {
         return(new Class(((NCC.MType.Class)objectType).tycon, cu, false));
     }
     else if (objectType is NCC.MType.Array)
     {
         return(new Class("System.Array", cu));
     }
     else if (objectType is NCC.MType.Fun)
     {
         return(GetTheRealType(((NCC.MType.Fun)objectType).to.Fix(), cu));
     }
     else if (objectType is NCC.MType.Ref)
     {
         return(GetTheRealType(((NCC.MType.Ref)objectType).t.Fix(), cu));
     }
     else if (objectType is NCC.MType.Out)
     {
         return(GetTheRealType(((NCC.MType.Out)objectType).t.Fix(), cu));
     }
     else
     {
         return(null);
     }
 }
Beispiel #2
0
        public Parameter(IMember declaringMember, Fun_parm pinfo, XmlNode docNode)
        {
            this.name = pinfo.Name;
            NCC.MType realType = (NCC.MType)pinfo.ty;
            if (realType is NCC.MType.Ref)
            {
                NCC.MType.Ref rt = (NCC.MType.Ref)realType;
                returnType = new ReturnType((NCC.MType)rt.t.Fix());
                modifier  |= ParameterModifier.Ref;
            }
            else if (realType is NCC.MType.Out)
            {
                NCC.MType.Out rt = (NCC.MType.Out)realType;
                returnType = new ReturnType((NCC.MType)rt.t.Fix());
                modifier  |= ParameterModifier.Out;
            }
            else
            {
                returnType = new ReturnType(realType);
            }
            this.declaringMember = declaringMember;

            try { LoadXml(docNode); } catch { }
        }
Beispiel #3
0
        public ReturnType(NCC.MType type)
        {
            base.arrayDimensions     = new int[0];
            base.pointerNestingLevel = 0;

            if (type is NCC.MType.Class)
            {
                NCC.MType.Class t = (NCC.MType.Class)type;
                base.FullyQualifiedName = t.tycon.FrameworkTypeName
                                          .Replace("`1", "")
                                          .Replace("`2", "")
                                          .Replace("`3", "")
                                          .Replace("`4", "");

                if (t.args.Length > 0)
                {
                    base.genericArguments = new ReturnTypeList();
                    foreach (NCC.TyVar tyvar in t.args)
                    {
                        base.genericArguments.Add(new ReturnType(tyvar.Fix()));
                    }
                }
            }
            else if (type is NCC.MType.TyVarRef)
            {
                base.FullyQualifiedName = ((NCC.MType.TyVarRef)type).tyvar.Name;
            }
            else if (type is NCC.MType.Fun)
            {
                // Use the plain type until Ambience works correctly
                base.FullyQualifiedName = Engine.GetNameFromType(type);
            }
            else if (type is NCC.MType.Tuple)
            {
                // Use the plain type until Ambience works correctly
                base.FullyQualifiedName = Engine.GetNameFromType(type);
            }
            else if (type is NCC.MType.Array)
            {
                NCC.MType.Array a   = (NCC.MType.Array)type;
                ReturnType      rtx = new ReturnType(a.t.Fix());
                this.FullyQualifiedName = rtx.FullyQualifiedName;
                this.arrayDimensions    = new int[rtx.ArrayDimensions.Length + 1];
                this.arrayDimensions[0] = a.rank;
                for (int i = 0; i < rtx.ArrayDimensions.Length; i++)
                {
                    this.arrayDimensions[i + 1] = rtx.ArrayDimensions[i];
                }
            }
            else if (type is NCC.MType.Void)
            {
                base.FullyQualifiedName = "System.Void";
            }
            else if (type is NCC.MType.Ref)
            {
                ReturnType rtx = new ReturnType(((NCC.MType.Ref)type).t.Fix());
                this.FullyQualifiedName = rtx.FullyQualifiedName;
                this.arrayDimensions    = rtx.ArrayDimensions;
            }
            else if (type is NCC.MType.Out)
            {
                ReturnType rtx = new ReturnType(((NCC.MType.Out)type).t.Fix());
                this.FullyQualifiedName = rtx.FullyQualifiedName;
                this.arrayDimensions    = rtx.ArrayDimensions;
            }
        }