示例#1
0
 public EmitFieldBuilder DefineField(string name, EmitType type, EmitVisibility visibility = EmitVisibility.Public,
     bool isStatic = false, bool isReadonly = false, bool isVolatile = false)
 {
     var field = new EmitFieldBuilder(this, name, type, visibility, isStatic, isReadonly);
     memberBuilders.Add(new EmitFieldReference(() => field));
     return field;
 }
        /// <summary>
        /// Creates a new particleEmitter
        /// </summary>
        /// <param name="repeat">Should the emitter stay active and keep emitting particles after the max amount of particles have been emitted</param>
        /// <param name="maxParticles">Max amount of particles</param>
        /// <param name="emitLocation">The location to emit from</param>
        /// <param name="direction">The velocity of the particles</param>
        /// <param name="particleSpeed">The speed of the particles</param>
        /// <param name="maxAngle">The angle based on the velocity the particles can be emitted from</param>
        /// <param name="particleLifeTime">Lifetime of particles in seconds</param>
        /// <param name="particleScale">Size of particles </param>
        /// <param name="particleShape">Particle shape</param>
        /// <param name="startColor">Starting particle color</param>
        /// <param name="autoStart">Should the emitter start immediatly</param>
        /// <param name="emitType">The type of the emitter</param>
        /// <param name="endColor">The color of the particle at the end</param>
        public ParticleEmitter(bool autoStart, bool repeat, int maxParticles, Vector2 emitLocation, Vector2 direction,
                               float particleSpeed, float maxAngle, float particleLifeTime, float particleScale, ParticleShape particleShape,
                               EmitType emitType, Color startColor, Color endColor)
        {
            this.repeat            = repeat;
            this.maxParticles      = maxParticles;
            this.Position          = emitLocation;
            this.ParticleDirection = direction;
            this.particleSpeed     = particleSpeed;
            this.maxAngle          = maxAngle;
            this.particleLifeTime  = particleLifeTime;
            this.particleScale     = particleScale;
            this.particleShape     = particleShape;
            this.emitType          = emitType;
            this.startColor        = startColor;
            this.endColor          = endColor;
            this.Paused            = !autoStart;
            random = new Random();

            if (repeat == false)
            {
                emitterLifeTime = particleLifeTime;
            }

            particleTexture = ParticleSystem.Instance.GetTexture(particleShape);
            ParticleSystem.Instance.AddEmitter(this);
        }
示例#3
0
        public EmitArrayInitializerExpression(EmitType type, EmitArrayInitializer initializer)
        {
            Type        = type;
            Initializer = initializer;

            if (Initializer.Length == 0)
            {
                throw new EmitVerifyException("An array initiaizler expression must have at least one element.");
            }

            Rank = 0;
            var lengths = new Queue <int>();

            lengths.Enqueue(Initializer.Length);
            var current = Initializer[0];

            while (current != null)
            {
                Rank++;
                if (current is EmitArrayInitializer)
                {
                    lengths.Enqueue(current.Length);
                    current = current[0];
                }
                else
                {
                    current = null;
                }
            }
            Lengths = lengths.ToArray();
        }
        public EmitArrayInitializerExpression(EmitType type, EmitArrayInitializer initializer)
        {
            Type = type;
            Initializer = initializer;

            if (Initializer.Length == 0)
                throw new EmitVerifyException("An array initiaizler expression must have at least one element.");

            Rank = 0;
            var lengths = new Queue<int>();
            lengths.Enqueue(Initializer.Length);
            var current = Initializer[0];
            while (current != null)
            {
                Rank++;
                if (current is EmitArrayInitializer)
                {
                    lengths.Enqueue(current.Length);
                    current = current[0];
                }
                else
                {
                    current = null;
                }
            }
            Lengths = lengths.ToArray();
        }
示例#5
0
    /// <summary>
    /// Init the specified type, amt, rangeminx, rangemaxx, rangeminy, rangemaxy and emit.
    /// </summary>
    /// <param name="type">Type.</param>
    /// <param name="amt">Amount.</param>
    /// <param name="rangeminx">Minimum Range of X value.</param>
    /// <param name="rangemaxx">Maximum Range of X value.</param>
    /// <param name="rangeminy">Minimum Range of Y value.</param>
    /// <param name="rangemaxy">Minimum Range of Y value.</param>
    /// <param name="emit">Type of Emission.</param>
    public void Init(ItemType[] type, int[] amt, float rangeminx, float rangemaxx, float rangeminy, float rangemaxy, 
						EmitType emit = EmitType.Impulse)
    {
        if(type.Length != amt.Length)
        {
            Debug.LogError("Total number of types and total number of amounts are different");
            return;
        }

        for(int i = 0; i < type.Length; ++i)
        {
            map.Add(type[i], amt[i]);
        }

        m_rangeMinX = rangeminx;
        m_rangeMaxX = rangemaxx;
        m_rangeMinY = rangeminy;
        m_rangeMaxY = rangemaxy;

        List<ItemType> keys = new List<ItemType>(map.Keys);

        m_type = emit;

        foreach(ItemType tp in keys)
        {
            if(m_type == EmitType.Impulse)
                ImpulseFire(tp, map[tp]);
            else
                StartCoroutine(CreateItemsWithInterval(tp, map[tp]));
        }
    }
示例#6
0
 public EmitMethodBuilder DefineMethod(string name, EmitType returnType, EmitVisibility visibility = EmitVisibility.Public,
     bool isAbstract = false, bool isSealed = false, bool isVirtual = false, bool isOverride = false,
     bool isExtern = false, bool isStatic = false)
 {
     var method = new EmitMethodBuilder(this, name, returnType, visibility, isStatic, isSealed, isVirtual, isAbstract);
     memberBuilders.Add(new EmitMethodReference(() => method));
     return method;
 }
示例#7
0
 public static EmitObjectCreationExpression New(this EmitType type)
 {
     if (!type.IsValueType)
     {
         var constructor = type.Members.OfType <EmitConstructor>().Single(x => x.Parameters.Count == 0);
         return(constructor.New());
     }
     return(new EmitObjectCreationExpression(type));
 }
示例#8
0
 public EmitTypeBuilder(EmitAssembly assembly, string ns, string name, EmitTypeKind kind, EmitType declaringType, 
     EmitVisibility visibility, EmitTypeReference baseType, Func<EmitType, IReadOnlyList<EmitTypeReference>> implementedInterfacesFactory,
     bool isAbstract, bool isSealed
 )
     : base(assembly, ns, name, kind, declaringType, 
         result => ((EmitTypeBuilder)result).memberBuilders = new List<EmitMemberReference>(), 
         visibility, baseType, implementedInterfacesFactory, isAbstract, isSealed)
 {
 }
示例#9
0
 public EmitArrayType(EmitAssembly assembly, string ns, string name, EmitTypeKind kind, EmitType declaringType, 
     Func<EmitType, IReadOnlyList<EmitMemberReference>> membersFactory, EmitTypeReference baseType, 
     EmitType elementType, int rank
 )
     : base(assembly, ns, name, kind, declaringType, membersFactory, elementType.Visibility, baseType, _ => new List<EmitTypeReference>(), true, true)
 {
     ElementType = elementType;
     Rank = rank;
 }
示例#10
0
        /// <summary>
        /// Copy the source object.
        /// </summary>
        /// <param name="src">Specifies the source data.</param>
        public override void Copy(OptionalParameter src)
        {
            base.Copy(src);

            if (src is EmitConstraint)
            {
                EmitConstraint p = (EmitConstraint)src;
                m_emitType     = p.emit_type;
                m_fEmitOverlap = p.emit_overlap;
            }
        }
示例#11
0
        public void InvokeInstanceMethod()
        {
            var x = 5;
            var y = +x;

            EmitType type   = typeof(InstanceMethodClass);
            var      method = CreateMethod(block => block.Return(type.New().Call((EmitMethod)type.Members.Single(o => o.Name == "Mirror"), "foo")));
            var      result = (string)method.Invoke(null, null);

            Assert.AreEqual("foo", result);
        }
示例#12
0
        public override void Compile(EmitCompilerContext context, EmitIl il)
        {
            Expression.Compile(context, il);

            var      expressionType = Expression.GetExpressionType();
            EmitType voidType       = typeof(void);

            if (expressionType.IsValueType && !context.Method.ReturnType.IsValueType && !Equals(expressionType, voidType))
            {
                il.Emit(EmitOpCodes.Box, Expression.GetExpressionType());
            }
//            else if (!Expression.GetType(context.TypeSystem).IsValueType && !context.Method.ReturnType.IsValueType)
//            {
//
//            }

            il.Emit(EmitOpCodes.Ret);
        }
示例#13
0
        /// <summary>
        /// Set default values
        /// </summary>
        protected override void DefaultValues()
        {
            base.DefaultValues();

            ////this.ShapeType = ShapeType.Point;

            this.LayerId           = DefaultLayers.Additive;
            this.emitType          = EmitType.Rate;
            this.emitDuration      = 0;
            this.emitAutomatically = true;
            this.EmitRate          = 100;
            this.MaxParticles      = 1000;
            this.InitColor         = Color.White;
            this.InitLife          = 1;
            this.InitSpeed         = 1;
            this.InitSize          = 0.1f;
            this.ForcesCategory    = ColliderCategory2D.Cat1;
            this.Space             = SpaceEnum.World;
            this.LifeFactor        = 1;
            this.TimeFactor        = 1;
        }
示例#14
0
        public override void Compile(EmitCompilerContext context, EmitIl il)
        {
            var item = il.DeclareLocal(Item.Type);

            Item.SetData(context, item);

            EmitType genericEnumerableType = typeof(IEnumerable <>);
            var      enumerableType        = genericEnumerableType.MakeGenericType(Item.Type);
            var      getEnumeratorMethod   = enumerableType.Members.OfType <EmitMethod>().Single(x => x.Name == nameof(IEnumerable <object> .GetEnumerator));

            EmitType genericEnumeratorType = typeof(IEnumerator <>);
            var      enumeratorType        = genericEnumeratorType.MakeGenericType(Item.Type);
            var      moveNextMethod        = enumerableType.Members.OfType <EmitMethod>().Single(x => x.Name == nameof(IEnumerator <object> .MoveNext));
            var      getCurrentMethod      = enumerableType.Members.OfType <EmitProperty>().Single(x => x.Name == nameof(IEnumerator <object> .Current)).GetMethod;

            var enumerator = il.DeclareLocal(enumeratorType);

            Collection.Compile(context, il);
            il.Emit(EmitOpCodes.Callvirt, getEnumeratorMethod);
            il.Emit(EmitOpCodes.Stloc, enumerator);

            var topOfLoop = il.DefineLabel();
            var end       = il.DefineLabel();

            il.MarkLabel(topOfLoop);
            il.Emit(EmitOpCodes.Ldloc, enumerator);
            il.Emit(EmitOpCodes.Callvirt, moveNextMethod);
            il.Emit(EmitOpCodes.Brfalse, end);

            il.Emit(EmitOpCodes.Ldloc, enumerator);
            il.Emit(EmitOpCodes.Callvirt, getCurrentMethod);
            il.Emit(EmitOpCodes.Stloc, item);

            Statement.Compile(context, il);
            il.Emit(EmitOpCodes.Br, topOfLoop);

            il.MarkLabel(end);
            il.Emit(EmitOpCodes.Nop);
        }
示例#15
0
            public MemberInfo VisitType(EmitType type, TypeBuilder parent)
            {
                var typeAttributes = ReflectionTypeAttributes.ToTypeAttributes(type.Kind, type.Visibility, type.DeclaringType != null, type.IsAbstract, type.IsSealed);
                var interfaces     = type.ImplementedInterfaces.Select(x => (Type)x).ToArray();

                TypeBuilder typeBuilder;

                if (parent == null)
                {
                    typeBuilder = moduleBuilder.DefineType(type.Name, typeAttributes, type.BaseType, interfaces);
                }
                else
                {
                    typeBuilder = parent.DefineNestedType(type.Name, typeAttributes, type.BaseType, interfaces);
                }

                foreach (var member in type.Members)
                {
                    member.Accept(this, typeBuilder);
                }

                return(typeBuilder);
            }
示例#16
0
 public EmitCastExpression(EmitExpression operand, EmitType type)
 {
     Operand = operand;
     Type = type;
 }
 public EmitArrayInitializerExpression(EmitType type, params IEmitArrayElement[] elements)
     : this(type, new EmitArrayInitializer(elements))
 {
 }
 public EmitObjectCreationExpression(EmitType valueType)
 {
     Type = valueType;
 }
示例#19
0
 public static EmitCastExpression Cast(this EmitExpression operand, EmitType type)
 {
     return new EmitCastExpression(operand, type);
 }
示例#20
0
 public static EmitVariableDeclarationStatement Declare(EmitType type)
 {
     return new EmitVariableDeclarationStatement(new EmitVariable(type));
 }
示例#21
0
 public EmitCastExpression(EmitExpression operand, EmitType type)
 {
     Operand = operand;
     Type    = type;
 }
示例#22
0
 public EmitLocal DeclareLocal(EmitType type)
 {
     var local = new EmitLocal(type);
     locals.Add(local);
     return local;
 }
示例#23
0
 private static Func<EmitType, IReadOnlyList<EmitTypeReference>> DeriveImplementedInterfaces(EmitType genericTypeDefinition)
 {
     return result => new List<EmitTypeReference>(genericTypeDefinition.ImplementedInterfaces.Select(x => new EmitTypeReference(() => x)));
 }
 public EmitObjectCreationExpression(EmitType valueType)
 {
     Type = valueType;
 }
 public EmitArrayCreationExpression(EmitType type, params EmitExpression[] lengths)
 {
     Type = type;
     Lengths = lengths;
 }
示例#26
0
 public static EmitCastExpression Cast(this EmitExpression operand, EmitType type)
 {
     return(new EmitCastExpression(operand, type));
 }
示例#27
0
 public static EmitArrayCreationExpression NewArray(this EmitType elementType, params EmitExpression[] length)
 {
     return(new EmitArrayCreationExpression(elementType, length));
 }
 public EmitArrayCreationExpression(EmitType type, params EmitExpression[] lengths)
 {
     Type    = type;
     Lengths = lengths;
 }
示例#29
0
 public EmitFieldBuilder(EmitType declaringType, string name, EmitType fieldType, EmitVisibility visibility, bool isStatic, bool isReadOnly)
     : base(declaringType, name, fieldType, visibility, isStatic, isReadOnly)
 {
 }
示例#30
0
        public override void Compile(EmitCompilerContext context, EmitIl il)
        {
            Operand.Compile(context, il);
            var operandType = Operand.GetExpressionType();

            EmitType typeInt     = typeof(int);
            EmitType typeUint    = typeof(uint);
            EmitType typeShort   = typeof(short);
            EmitType typeUshort  = typeof(ushort);
            EmitType typeByte    = typeof(byte);
            EmitType typeSbyte   = typeof(sbyte);
            EmitType typeLong    = typeof(long);
            EmitType typeUlong   = typeof(ulong);
            EmitType typeDouble  = typeof(double);
            EmitType typeFloat   = typeof(float);
            EmitType typeDecimal = typeof(decimal);
            EmitType typeBool    = typeof(bool);

            var typeIs32Bit            = Equals(Type, typeByte) || Equals(Type, typeShort) || Equals(Type, typeInt) || Equals(Type, typeSbyte) || Equals(Type, typeUshort) || Equals(Type, typeUint);
            var operandIs32Bit         = Equals(operandType, typeByte) || Equals(operandType, typeShort) || Equals(operandType, typeInt) || Equals(operandType, typeSbyte) || Equals(operandType, typeUshort) || Equals(operandType, typeUint);
            var typeIsFloatingPoint    = Equals(Type, typeFloat) || Equals(Type, typeDouble);
            var operandIsFloatingPoint = Equals(operandType, typeFloat) || Equals(operandType, typeDouble);

            if (operandIs32Bit || operandIsFloatingPoint || Equals(operandType, typeLong))
            {
                if (Equals(Type, operandType))
                {
                    return;
                }
                if (Equals(Type, typeFloat))
                {
                    il.Emit(EmitOpCodes.Conv_R4);
                    return;
                }
                if (Equals(Type, typeDouble))
                {
                    il.Emit(EmitOpCodes.Conv_R8);
                    return;
                }
                if (Equals(Type, typeByte))
                {
                    il.Emit(EmitOpCodes.Conv_U1);
                    return;
                }
                if (Equals(Type, typeSbyte))
                {
                    il.Emit(EmitOpCodes.Conv_I1);
                    return;
                }
                if (Equals(Type, typeShort))
                {
                    il.Emit(EmitOpCodes.Conv_I2);
                    return;
                }
                if (Equals(Type, typeUshort))
                {
                    il.Emit(EmitOpCodes.Conv_U2);
                    return;
                }
                if (Equals(Type, typeInt))
                {
                    il.Emit(EmitOpCodes.Conv_I4);
                    return;
                }
                if (Equals(Type, typeUint))
                {
                    il.Emit(EmitOpCodes.Conv_U4);
                    return;
                }
                if (Equals(Type, typeLong))
                {
                    il.Emit(EmitOpCodes.Conv_I8);
                    return;
                }
                if (Equals(Type, typeUlong))
                {
                    il.Emit(EmitOpCodes.Conv_U8);
                    return;
                }
            }

            // All else fails, then:
            il.Emit(EmitOpCodes.Castclass, Type);
        }
示例#31
0
 public EmitLocal(EmitType type)
 {
     Type = type;
 }
示例#32
0
 public EmitArrayInitializerExpression(EmitType type, params IEmitArrayElement[] elements) : this(type, new EmitArrayInitializer(elements))
 {
 }
示例#33
0
 /// <summary>
 /// Copy the source object.
 /// </summary>
 /// <param name="src">Specifies the source data.</param>
 public void Copy(EmitConstraint src)
 {
     m_emitType     = src.emit_type;
     m_fEmitOverlap = src.emit_overlap;
 }
示例#34
0
 public EmitFieldBuilder(EmitType declaringType, string name, EmitType fieldType, EmitVisibility visibility, bool isStatic, bool isReadOnly) : base(declaringType, name, fieldType, visibility, isStatic, isReadOnly)
 {
 }
示例#35
0
 public EmitVariable(EmitType type)
 {
     Type = type;
 }
示例#36
0
 public EmitInstruction Emit(IEmitOpCodeType opCode, EmitType type)
 {
     var instruction = new EmitInstruction(opCode, type);
     AddInstruction(instruction);
     return instruction;
 }
示例#37
0
 public static EmitVariableDeclarationStatement Declare(EmitType type)
 {
     return(new EmitVariableDeclarationStatement(new EmitVariable(type)));
 }
示例#38
0
 public static EmitVariableDeclarationStatement Declare(this EmitBlockStatement block, EmitType type)
 {
     var result = Declare(type);
     block.Statements.Add(result);
     return result;
 }
示例#39
0
        public static EmitVariableDeclarationStatement Declare(this EmitBlockStatement block, EmitType type)
        {
            var result = Declare(type);

            block.Statements.Add(result);
            return(result);
        }
示例#40
0
        public void Emit()
        {
            _returnValue = RootTable.CreateInternalValue(GetTypeSymbol(SpecialType.System_UInt32), "returnJump");

            CurrentNode = EmitType.RoslynSymbol.DeclaringSyntaxReferences.First().GetSyntax();

            DefaultExecutionOrder executionOrder = EmitType.GetAttribute <DefaultExecutionOrder>();

            if (executionOrder != null)
            {
                if (executionOrder.order < (int.MinValue + 1000000))
                {
                    throw new CompilerException($"Execution orders below int.MinValue + 1000000 are reserved for internal use in U#");
                }

                Module.ExecutionOrder = executionOrder.order;
            }

            TypeSymbol udonSharpBehaviourType = GetTypeSymbol(typeof(UdonSharpBehaviour));

            Stack <TypeSymbol> emitTypeBases = new Stack <TypeSymbol>();

            TypeSymbol currentEmitType = EmitType;

            while (currentEmitType.BaseType != null)
            {
                emitTypeBases.Push(currentEmitType);
                currentEmitType = currentEmitType.BaseType;

                if (currentEmitType == udonSharpBehaviourType)
                {
                    break;
                }
            }

            if (currentEmitType != udonSharpBehaviourType)
            {
                throw new NotSupportedException("U# behaviour must inherit from UdonSharpBehaviour",
                                                currentEmitType.RoslynSymbol.DeclaringSyntaxReferences.First().GetSyntax().GetLocation());
            }

            List <MethodSymbol> rootMethods = new List <MethodSymbol>();

            List <FieldSymbol>    userFields    = new List <FieldSymbol>();
            HashSet <FieldSymbol> visitedFields = new HashSet <FieldSymbol>();

            // Visits each base class and searches for the most derived version of a method if it is overriden
            // The intention with this is to ensure a consistent ordering between all inheritors of a base class
            // This means that we can know that all inheritors of a class have the same method names and parameter symbol allocations
            //   which allows people to call virtual methods on UdonSharpBehaviours and have Udon just make it work
            while (emitTypeBases.Count > 0)
            {
                TypeSymbol currentBase = emitTypeBases.Pop();

                // Make sure fields get emitted
                foreach (FieldSymbol field in currentBase.GetMembers <FieldSymbol>(this))
                {
                    if (field.IsConst)
                    {
                        continue;
                    }

                    if (!visitedFields.Contains(field))
                    {
                        userFields.Add(field);
                        visitedFields.Add(field);
                    }

                    GetUserValue(field);
                }

                foreach (MethodSymbol methodSymbol in currentBase.GetMembers <MethodSymbol>(this))
                {
                    if (methodSymbol.RoslynSymbol.IsImplicitlyDeclared ||
                        methodSymbol.RoslynSymbol.IsStatic)
                    {
                        continue;
                    }

                    if (methodSymbol.HasOverrides)
                    {
                        MethodSymbol derivedMethod = GetMostDerivedMethod(methodSymbol);

                        if (derivedMethod.RoslynSymbol.IsAbstract)
                        {
                            continue;
                        }

                        if (!rootMethods.Contains(derivedMethod))
                        {
                            rootMethods.Add(derivedMethod);
                        }
                    }
                    else if (!rootMethods.Contains(methodSymbol))
                    {
                        if (methodSymbol.RoslynSymbol.IsAbstract)
                        {
                            continue;
                        }

                        rootMethods.Add(methodSymbol);
                    }
                }
            }

            DeclaredFields = userFields.ToImmutableArray();
            InitConstFields();

            HashSet <MethodSymbol> emittedSet = new HashSet <MethodSymbol>();
            HashSet <MethodSymbol> setToEmit  = new HashSet <MethodSymbol>();

            // Do not roll this into the while loop, the order must be maintained for the root symbols so calls across behaviours work consistently
            foreach (MethodSymbol methodSymbol in rootMethods)
            {
                using (new MethodEmitScope(methodSymbol, this))
                {
                    methodSymbol.Emit(this);
                }

                emittedSet.Add(methodSymbol);

                setToEmit.UnionWith(methodSymbol.DirectDependencies.OfType <MethodSymbol>());
            }

            while (setToEmit.Count > 0)
            {
                HashSet <MethodSymbol> newEmitSet = new HashSet <MethodSymbol>();

                foreach (var methodSymbol in setToEmit)
                {
                    if (emittedSet.Contains(methodSymbol))
                    {
                        continue;
                    }
                    if (methodSymbol.RoslynSymbol != null)
                    {
                        if (methodSymbol.RoslynSymbol.IsAbstract || methodSymbol.IsUntypedGenericMethod)
                        {
                            continue;
                        }
                    }

                    if (!methodSymbol.IsStatic && methodSymbol.ContainingType.IsUdonSharpBehaviour) // Prevent other behaviour type's methods from leaking into this type from calls across behaviours
                    {
                        TypeSymbol topType   = EmitType;
                        bool       foundType = false;
                        while (topType != udonSharpBehaviourType)
                        {
                            if (methodSymbol.ContainingType == topType)
                            {
                                foundType = true;
                                break;
                            }
                            topType = topType.BaseType;
                        }

                        if (!foundType)
                        {
                            continue;
                        }
                    }

                    using (new MethodEmitScope(methodSymbol, this))
                    {
                        methodSymbol.Emit(this);
                    }

                    emittedSet.Add(methodSymbol);

                    newEmitSet.UnionWith(methodSymbol.DirectDependencies.OfType <MethodSymbol>());
                }

                setToEmit = newEmitSet;
            }

            if (_recursiveStackVal != null)
            {
                _recursiveStackVal.DefaultValue = new object[_maxRecursiveStackPush];
            }

            DebugInfo.FinalizeAssemblyInfo();
        }
示例#41
0
 public EmitMethodBuilder(EmitType declaringType, string name, EmitType returnType, EmitVisibility visibility, bool isStatic, bool isSealed, bool isVirtual, bool isAbstract)
     : base(declaringType, name, returnType, 
         result => ((EmitMethodBuilder)result).parameters = new List<EmitParameter>(),
         visibility, isStatic, isSealed, isVirtual, isAbstract)
 {
 }
示例#42
0
 public EmitVariable(EmitType type)
 {
     Type = type;
 }
示例#43
0
 public static EmitArrayInitializerExpression NewArrayFrom(this EmitType elementType, Array elements)
 {
     return(new EmitArrayInitializerExpression(elementType, elements));
 }
示例#44
0
 public EmitGenericType(EmitAssembly assembly, string ns, string name, EmitType declaringType, Func<EmitType, IReadOnlyList<EmitMemberReference>> membersFactory, EmitTypeReference baseType, EmitType genericTypeDefinition, IReadOnlyList<EmitType> typeArguments)
     : base(assembly, ns, name, genericTypeDefinition.Kind, declaringType, membersFactory, genericTypeDefinition.Visibility, baseType, DeriveImplementedInterfaces(genericTypeDefinition), genericTypeDefinition.IsAbstract, genericTypeDefinition.IsSealed)
 {
     GenericTypeDefinition = genericTypeDefinition;
     TypeArguments = typeArguments;
 }
示例#45
0
 public EmitConstructorBuilder(EmitType declaringType, EmitVisibility visibility, bool isStatic)
     : base(declaringType, result => ((EmitConstructorBuilder)result).parameters = new List<EmitParameter>(), 
         visibility, isStatic)
 {
 }
示例#46
0
 public EmitLocal(EmitType type)
 {
     Type = type;
 }
示例#47
0
 public EmitParameter DefineParameter(EmitType parameterType, string name = null)
 {
     var parameter = new EmitParameter(name, parameterType);
     parameters.Add(parameter);
     return parameter;
 }