Beispiel #1
0
        public SystemTypes(IAssembly assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }

            _assembly = assembly.Corlib();
            _types    = new IType[Types.Length];
        }
Beispiel #2
0
        public CorlibTypes(IAssembly assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }

            _assembly = assembly.Corlib();

            _types = new[]
            {
                new LazyType(() => FindType("System.NullReferenceException")),
                new LazyType(() => FindType("System.InvalidCastException")),
                new LazyType(() => FindType("System.NotImplementedException")),
                new LazyType(() => FindType("System.NotSupportedException")),
                new LazyType(() => FindType("System.IndexOutOfRangeException")),
                new LazyType(() => FindType("System.ArgumentOutOfRangeException")),
                new LazyType(() => FindType("System.ExecutionEngineException")),
                new LazyType(() => FindType("System.TypeLoadException")),
                new LazyType(() => FindType("System.EnumInfo")),
                new LazyType(() => FindType("System.Environment")),
                new LazyType(() => FindType("System.Reflection.Assembly")),
                new LazyType(() => FindType("System.CharEnumerator")),
                new LazyType(() => FindType("System.Convert")),
                new LazyType(() => FindType("System.Reflection.FieldInfo")),
                new LazyType(() => FindType(CLRNames.Types.IEnumerable)),
                new LazyType(() => FindType(CLRNames.Types.IEnumerator)),
                new LazyType(() => FindType(CLRNames.Types.IDictionary)),
                new LazyType(() => FindType("System.Reflection.MethodBase")),
                new LazyType(() => FindType("System.Reflection.MethodInfo")),
                new LazyType(() => FindType("System.Reflection.ConstructorInfo")),
                new LazyType(() => FindType("System.Reflection.ParameterInfo")),
                new LazyType(() => FindType("System.Reflection.PropertyInfo")),
                new LazyType(() => FindType("System.Console")),
                new LazyType(() => FindType("PageFX.CompilerUtils"))
            };

            _generics = new[]
            {
                new LazyType(() => FindGenericType(CLRNames.Types.ICollectionT)),
                new LazyType(() => FindGenericType(CLRNames.Types.IEnumerableT)),
                new LazyType(() => FindGenericType(CLRNames.Types.IEnumeratorT)),
                new LazyType(() => FindGenericType(CLRNames.Types.IListT)),
                new LazyType(() => FindGenericType(CLRNames.Types.NullableT)),
                new LazyType(() => FindGenericType("System.Array+Enumerator`1"))
            };
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JsCompiler"/> class.
        /// </summary>
        /// <param name="assembly">The assembly to be compiled.</param>
        public JsCompiler(IAssembly assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }

            if (assembly.EntryPoint == null)
            {
                throw new NotSupportedException("Class library is not supported yet!");
            }

            _assembly = assembly;
            _corlib   = assembly.Corlib();

            CorlibTypes = new CorlibTypes(assembly);
        }