public NativeCompiledInitializer(InitializerType type, IDiscreteBinding binding, Func <object, ExecutionContext, object> functionDelegate)
     : base(type, binding)
 {
     if (functionDelegate == null)
     {
         throw new ArgumentNullException("functionDelegate");
     }
     this.Delegate = functionDelegate;
 }
 protected RuntimeCompiledInitializer(InitializerType type, IDiscreteBinding binding, InitializerNode parseTree, IDebugInfoService debugInfoService)
     : base(type, binding)
 {
     if (parseTree == null)
     {
         throw new ArgumentNullException();
     }
     this.ParseTree        = parseTree;
     this.DebugInfoService = debugInfoService;
 }
Пример #3
0
        private static CompiledInitializer AddInitializer(SmalltalkNameScope scope, InitializerType type, IDiscreteBinding binding, Type delegateType, string delegateName)
        {
            MethodInfo method = TypeUtilities.Method(delegateType, delegateName, BindingFlags.Public | BindingFlags.Static, NativeLoadHelper.InitializerDelegateTypes);
            Func <object, ExecutionContext, object> functionDelegate = (Func <object, ExecutionContext, object>)method.CreateDelegate(typeof(Func <object, ExecutionContext, object>));

            NativeCompiledInitializer initializer = new NativeCompiledInitializer(type, binding, functionDelegate);

            scope.Initializers.Add(initializer);
            return(initializer);
        }
Пример #4
0
        protected CompiledInitializer(InitializerType type, IDiscreteBinding binding)
        {
            if (type == InitializerType.ProgramInitializer)
            {
                if (binding != null)
                {
                    throw new ArgumentException("ProgramInitializers must have null binding.");
                }
            }
            else if (type == InitializerType.ClassInitializer)
            {
                if (binding == null)
                {
                    throw new ArgumentNullException("binding");
                }
                if (!(binding is ClassBinding))
                {
                    throw new ArgumentException("ClassInitializers must have binding of type ClassBinding.");
                }
            }
            else if (type == InitializerType.GlobalInitializer)
            {
                if (binding == null)
                {
                    throw new ArgumentNullException("binding");
                }
                if (!(binding is GlobalVariableOrConstantBinding))
                {
                    throw new ArgumentException("ClassInitializers must have binding of type GlobalVariableOrConstantBinding.");
                }
            }
            else if (type == InitializerType.PoolVariableInitializer)
            {
                if (binding == null)
                {
                    throw new ArgumentNullException("binding");
                }
                if (!(binding is PoolVariableOrConstantBinding))
                {
                    throw new ArgumentException("ClassInitializers must have binding of type PoolVariableOrConstantBinding.");
                }
            }
            else
            {
                throw new ArgumentOutOfRangeException("type");
            }

            this.Type    = type;
            this.Binding = binding;
        }
Пример #5
0
 public SwiftInitializerType(InitializerType initType, SwiftType ret, SwiftClassType owner, SwiftName name)
     : base(SwiftTupleType.Empty, ret, false, false, name, null)
 {
     Owner           = Ex.ThrowOnNull(owner, nameof(owner));
     InitializerType = initType;
 }
 public InitializerExpression(BlockExpression expression, InitializerType initializerType, IEnumerable <Instruction> instructions)
     : base(instructions)
 {
     this.Expression      = expression;
     this.InitializerType = initializerType;
 }
 public InitializerExpression(BlockExpression expression, InitializerType initializerType)
     : this(expression, initializerType, Enumerable.Empty <Instruction>())
 {
 }
 public InitializerExpression(ExpressionCollection expressions, InitializerType initializerType)
     : this(new BlockExpression(expressions, null), initializerType, Enumerable.Empty <Instruction>())
 {
 }
Пример #9
0
 public UpdateInitializerCommand(InitializerType initializerType, IParticleInitializer updatedInstance)
 {
     _initializerType = initializerType;
     _updatedInstance = updatedInstance;
 }
        /// <summary>
        /// Setst the <see cref="InitializerType"/> setting of the <see cref="LearningPipeline"/> to the specified value.
        /// </summary>
        /// <param name="pipeline">The learning pipeline.</param>
        /// <param name="initializerType">The type of initializer.</param>
        /// <returns>The configured pipeline.</returns>
        public static LearningPipeline SetWeightsInitializer(this LearningPipeline pipeline, InitializerType initializerType)
        {
            pipeline.PipelineSettings.WeightsInitializerType = initializerType;

            return(pipeline);
        }
		public InitializerExpression(BlockExpression expression, InitializerType initializerType, IEnumerable<Instruction> instructions)
			: base(instructions)
		{
			this.Expression = expression;
			this.InitializerType = initializerType;
		}
		public InitializerExpression(BlockExpression expression, InitializerType initializerType)
			: this(expression, initializerType, Enumerable.Empty<Instruction>())
		{
		}
		public InitializerExpression(ExpressionCollection expressions, InitializerType initializerType)
			: this(new BlockExpression(expressions, null), initializerType, Enumerable.Empty<Instruction>())
		{
		}