示例#1
0
 public CUnionType(CToken token, String rawname, String name)
     : base(token, "__Unamed_Union" + unnamedCount++)
 {
     CProgram.Global.AddClass(base.Name, this);
     NameToken = CToken.Identifer(token, name, rawname);
     CProgram.Global.AddClass(base.Name, this);
 }
示例#2
0
 public CUnionType(CToken token)
     : base(token, "__Unamed_Union" + unnamedCount++)
 {
     CProgram.Global.AddClass(base.Name, this);
     NameToken = CToken.Identifer(token, "", "");
     IsObject  = false;
 }
示例#3
0
        public CClass(CToken token, String rawname, String name, CTypeRef baseClass)
            : base(token)
        {
            originalClassName  = name;
            className          = CToken.Identifer(token, name, rawname);
            canConvertToString = false;

            this.baseClass = new CTypeRef(this, baseClass);
            base.LoadType(this);
        }
示例#4
0
        private CProgram()
            : base(null)
        {
            global = this;

            classes["String"]    = BuiltIns.String;
            classes["Int32"]     = BuiltIns.Int32;
            classes["Int64"]     = BuiltIns.Int32;
            classes["Character"] = BuiltIns.Character;
            classes["Boolean"]   = BuiltIns.Boolean;
            classes["Date"]      = BuiltIns.Date;
            classes["Double"]    = BuiltIns.Double;

            classes["__Object"]  = BuiltIns.Object;
            classes["__Variant"] = BuiltIns.Variant;

            // lowercase alias
            classes["byte"]      = BuiltIns.Byte;
            classes["string"]    = BuiltIns.String;
            classes["int32"]     = BuiltIns.Int32;
            classes["int64"]     = BuiltIns.Int32;
            classes["character"] = BuiltIns.Character;
            classes["boolean"]   = BuiltIns.Boolean;
            classes["date"]      = BuiltIns.Date;
            classes["double"]    = BuiltIns.Double;
            classes["object"]    = BuiltIns.Object;
            classes["variant"]   = BuiltIns.Variant;

            classes["DbNull"]  = BuiltIns.DbNull;
            classes["dbnull"]  = BuiltIns.DbNull;
            classes["Nothing"] = BuiltIns.Nothing;

            classes["__Void"] = BuiltIns.Void;

            foreach (KeyValuePair <string, CClass> e in classes)
            {
                e.Value.SetSemanticallyComplete();
                universalClasses[e.Key] = e.Value;
            }

            // Add valueOf method to Date object
            CFunction valueOf = new CFunction(new CToken("", 1, 0, "", TokenTypes.identifier, "valueof", "valueOf", true),
                                              "valueOf", "valueof", TokenTypes.visPublic, FunctionType.Function, new CArgumentList(),
                                              new CTypeRef(null, BuiltIns.Int32));

            valueOf.Attributes.Add(CToken.Identifer(valueOf.Token, "suppressusagewarning"), new CTypeRef(null, CToken.Identifer(valueOf.Token, "SuppressUsageWarningAttribute")));
            valueOf.Attributes.Add(CToken.Identifer(valueOf.Token, "executeonclient"), new CTypeRef(null, CToken.Identifer(valueOf.Token, "ExecuteOnClientAttribute")));
            valueOf.Class = BuiltIns.Date;
            BuiltIns.Date.SetMember("valueof", new CMethod(valueOf));
        }
 public CLambdaFunction(CToken token, CFunction containingFunction, CFile containingFile, String name, CTypeRef tref,
                        CArgumentList args)
     : base(token, name, name, TokenTypes.visInternal, FunctionType.Function, args, tref)
 {
     this.containingFunction = containingFunction;
     this.containingFile     = containingFile;
     if (this.containingFunction != null)
     {
         this.containingFunction.Lambdas.Add(this);
     }
     else
     {
         this.containingFile.Lambdas.Add(this);
     }
     CallCount++;
     Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute")));
 }
示例#6
0
 public virtual void Add(CTypeRef tref)
 {
     if (tref.Resolved && tref.ActualType is CUnionType)
     {
         Add((CUnionType)tref.ActualType);
     }
     else
     {
         string prefix = " Or ";
         if (Name == "")
         {
             prefix = "";
         }
         NameToken =
             CToken.Identifer(NameToken, Name + prefix + tref.TypeName.Value,
                              RawName + prefix + tref.TypeName.RawValue);
         types.Add(new CTypeRef(this, tref));
     }
 }
        public CFunctionType(CToken token, CFunction function, bool declarationOnly)
            : base(token, function.TypeSignature)
        {
            target = function;
            this.declarationOnly = declarationOnly;

            CMethod method = new CMethod(function);

            DefaultMember = method;

            function.TypeChanged += new EventHandler(function_TypeChanged);
            foreach (CArgument arg in function.Arguments)
            {
                arg.TypeChanged += new EventHandler(function_TypeChanged);
            }

            this.IsSealed = true;

            // we don't actually want people accessing the default method directly
            // we also don't want it to get visited through the type.
            // so we don't do this: Members.Add(function.Name, method);
            Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute")));
        }
示例#8
0
 public virtual void Add(String type, String rawtype)
 {
     Add(new CTypeRef(this, CToken.Identifer(null, type, rawtype)));
 }
示例#9
0
 public CTypeRef(CNode owner, string name) : this(owner)
 {
     InternalLoad(CToken.Identifer(null, name));
 }
示例#10
0
        private void UpdateName()
        {
            string name = target.TypeSignature;

            NameToken = CToken.Identifer(NameToken, name, name);
        }