示例#1
0
 public Function(IdContainer Container, CodeString Name, TypeOfFunction Type, FunctionOverloads Overload)
     : base(Container, Name)
 {
     this.Overload       = Overload;
     this.Children       = new Identifier[] { Type };
     this.DeclaredIdType = DeclaredIdType.Function;
 }
示例#2
0
        public Constructor CreateDeclaredConstructor(CodeString Declaration, FunctionParameter[] Params, List <Modifier> Mods = null)
        {
            if (ConstructorOverloads == null)
            {
                ConstructorOverloads = new FunctionOverloads(null);
            }

            var RetType = (Type)GlobalContainer.CommonIds.Void;

            if (StructuredType is ClassType)
            {
                if ((Mods == null || (Modifiers.GetFlags(Mods) & IdentifierFlags.Static) == 0) &&
                    (StructuredType.Flags & (IdentifierFlags.Static | IdentifierFlags.Abstract)) == 0)
                {
                    RetType = StructuredType;
                }
            }

            var FuncType = new TypeOfFunction(this, DefaultCallConv, RetType, Params);
            var Func     = new Constructor(this, FuncType, ConstructorOverloads, Declaration);

            if (!AdjustAndDeclareFunction(Func, Mods))
            {
                return(null);
            }
            return(Func);
        }
示例#3
0
 public override Function OnCreateFunction(CodeString Name, TypeOfFunction FuncType,
                                           FunctionOverloads Overload, List <Modifier> Mods = null)
 {
     if (Mods != null && (Modifiers.GetFlags(Mods) & IdentifierFlags.Static) != 0)
     {
         return(new Function(this, Name, FuncType, Overload));
     }
     else
     {
         return(new MemberFunction(this, Name, FuncType, Overload));
     }
 }
示例#4
0
        public FunctionOverloads GetOverload(string Name)
        {
            for (var i = 0; i < FunctionOverloads.Count; i++)
            {
                var Overload = FunctionOverloads[i];
                if (Overload.Name == Name)
                {
                    return(Overload);
                }
            }

            var Ret = new FunctionOverloads(Name);

            FunctionOverloads.Add(Ret);
            return(Ret);
        }
示例#5
0
 public override Function OnCreateFunction(CodeString Name, TypeOfFunction FuncType,
                                           FunctionOverloads Overload, List <Modifier> Mods = null)
 {
     throw new ApplicationException();
 }
示例#6
0
 public virtual Function OnCreateFunction(CodeString Name, TypeOfFunction FuncType,
                                          FunctionOverloads Overload = null, List <Modifier> Mods = null)
 {
     return(new Function(this, Name, FuncType, Overload));
 }
示例#7
0
 public Constructor(IdContainer Container, TypeOfFunction Type, FunctionOverloads Overload, CodeString Declaration)
     : base(Container, new CodeString(), Type, Overload)
 {
     this.Declaration    = Declaration;
     this.DeclaredIdType = DeclaredIdType.Constructor;
 }
示例#8
0
 public MemberFunction(IdContainer Container, CodeString Name, TypeOfFunction Type,
                       FunctionOverloads Overload)
     : base(Container, Name, Type, Overload)
 {
 }