public void VisitInterface(CInterface iface)
 {
     if (canGenerate(iface))
     {
         classname = iface.RawName;
         visitor.VisitInterface(iface);
         classname = "";
     }
 }
Esempio n. 2
0
        static BuiltIns()
        {
            /* These aren't fully resolved; we need to use Cecil to load the appropriate .NET type defitinions in.
               See ClrImporter.LoadBuiltins. */
            Variant = new CClass("__Variant", null);
            Byte = new CClass("Byte", false);
            String = new CClass("String", true);
            Int32 = new CClass("Int32", true);
            Int64 = new CClass("Int64", true);
            Character = new CClass("Character", false);
            Boolean = new CClass("Boolean", true);
            Date = new CClass("Date", true);
            Double = new CClass("Double", true);
            Object = Variant;
            DbNull = new CClass("DbNull", false);
            Nothing = new CClass("Nothing", false);
            Nothing.Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute")));
            Void = new CClass("__Void", false);
            FunctionPlaceHolder = new CClass("__FunctionPlaceHolder", false);
            FunctionPlaceHolder.Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute")));
            SubPlaceHolder = new CClass("__SubPlaceHolder", false);
            SubPlaceHolder.Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute")));

            SetupGlobalTypes();

            CArgumentList arrArgs = new CArgumentList();
            arrArgs.Add(new CArgument(CToken.Keyword(null, "byval"),
                CToken.Identifer(null, "arglist"),
                new CTypeRef(null, Variant)));
            Array = new CFunction(CToken.Identifer(null, "Array"), "Array", "array", TokenTypes.visPublic, FunctionType.Function,
                arrArgs, new CTypeRef(null, new CArrayType(new CTypeRef(null, Variant), 1)));
            Array.Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute")));

            CArgumentList dicArgs = new CArgumentList();
            dicArgs.Add(new CArgument(CToken.Keyword(null, "byval"),
                CToken.Identifer(null, "arglist"),
                new CTypeRef(null, Variant)));
            Dictionary = new CFunction(CToken.Identifer(null, "Dictionary"), "Dictionary", "dictionary", TokenTypes.visPublic, FunctionType.Function,
                dicArgs, new CTypeRef(null, new CDictionaryType(new CTypeRef(null, Variant))));
            Dictionary.Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute")));

            CArgumentList refArgs = new CArgumentList();
            refArgs.Add(new CArgument(CToken.Keyword(null, "byval"),
                CToken.Identifer(null, "func"),
                new CTypeRef(null, BuiltIns.String)));
            GetRef = new CFunction(CToken.Identifer(null, "GetRef"), "GetRef", "getref", TokenTypes.visPublic, FunctionType.Function, refArgs,
                new CTypeRef(null, BuiltIns.FunctionPlaceHolder));
            GetRef.Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute")));

            // add string ienumerator interface
            CToken ifaceName = CToken.Identifer(null, "System.Collections.Generic.IEnumerable`1<char>");
            CInterface iface = new CInterface(ifaceName, ifaceName);
            iface.GenericParameters.Add(Character);
            String.AddInterface(new CTypeRef(null, iface));
        }