Ejemplo n.º 1
0
        public BlockDispatcher0(BlockCallTarget0/*!*/ block, BlockSignatureAttributes attributes)
            : base(attributes) {
            Assert.NotNull(block);
            Debug.Assert(!HasUnsplatParameter);

            _block = block;
        }
Ejemplo n.º 2
0
 public BlockDispatcher1(BlockCallTarget1 /*!*/ block, BlockSignatureAttributes attributes)
     : base(attributes)
 {
     Assert.NotNull(block);
     Debug.Assert(!HasUnsplatParameter);
     _block = block;
 }
Ejemplo n.º 3
0
        internal BlockDispatcherUnsplatN(int parameterCount, BlockSignatureAttributes attributesAndArity, string sourcePath, int sourceLine)
            : base(attributesAndArity, sourcePath, sourceLine)
        {
            Debug.Assert(HasUnsplatParameter);

            _parameterCount = parameterCount;
        }
Ejemplo n.º 4
0
        internal BlockDispatcherUnsplatN(BlockCallTargetUnsplatN/*!*/ block, int parameterCount, BlockSignatureAttributes attributes) 
            : base(attributes) {
            Assert.NotNull(block);
            Debug.Assert(HasUnsplatParameter);

            _parameterCount = parameterCount;
            _block = block;
        }
Ejemplo n.º 5
0
        internal BlockDispatcherN(BlockCallTargetN/*!*/ block, int parameterCount, BlockSignatureAttributes attributesAndArity)
            : base(attributesAndArity) {
            Assert.NotNull(block);
            Debug.Assert(parameterCount > BlockDispatcher.MaxBlockArity);
            Debug.Assert(!HasUnsplatParameter);

            _parameterCount = parameterCount;
            _block = block;
        }
        internal BlockDispatcherN(int parameterCount, BlockSignatureAttributes attributesAndArity, string sourcePath, int sourceLine)
            : base(attributesAndArity, sourcePath, sourceLine)
        {
            Debug.Assert(parameterCount > BlockDispatcher.MaxBlockArity);
            Debug.Assert(!HasUnsplatParameter);
            Debug.Assert(!HasSingleCompoundParameter);

            _parameterCount = parameterCount;
        }
Ejemplo n.º 7
0
        internal BlockDispatcherN(BlockCallTargetN /*!*/ block, int parameterCount, BlockSignatureAttributes attributes)
            : base(attributes)
        {
            Assert.NotNull(block);
            Debug.Assert(parameterCount > BlockDispatcher.MaxBlockArity);
            Debug.Assert(!HasUnsplatParameter);

            _parameterCount = parameterCount;
            _block          = block;
        }
Ejemplo n.º 8
0
 internal static Type/*!*/ GetDelegateType(int parameterCount, BlockSignatureAttributes attributes) {
     if ((attributes & BlockSignatureAttributes.HasUnsplatParameter) == 0) {
         switch (parameterCount) {
             case 0: return typeof(BlockCallTarget0);
             case 1: return typeof(BlockCallTarget1);
             case 2: return typeof(BlockCallTarget2);
             case 3: return typeof(BlockCallTarget3);
             case 4: return typeof(BlockCallTarget4);
             default: return typeof(BlockCallTargetN);
         }
     }
     return typeof(BlockCallTargetUnsplatN);
 }
Ejemplo n.º 9
0
 public static Proc/*!*/ Create(RubyContext/*!*/ context, int parameterCount, BlockSignatureAttributes signatureAttributes, Delegate/*!*/ clrMethod) {
     // scope is used to get to the execution context:
     return new Proc(ProcKind.Block, null, context.EmptyScope,
         BlockDispatcher.Create(parameterCount, signatureAttributes, null, 0).SetMethod(clrMethod)
     );
 }
 internal BlockDispatcherProcN(int parameterCount, BlockSignatureAttributes attributesAndArity, string sourcePath, int sourceLine)
     : base(parameterCount, attributesAndArity, sourcePath, sourceLine)
 {
     Debug.Assert(!HasUnsplatParameter);
     Debug.Assert(HasProcParameter);
 }
Ejemplo n.º 11
0
 public static Proc /*!*/ Create(RubyContext /*!*/ context, int parameterCount, BlockSignatureAttributes signatureAttributes, Delegate /*!*/ clrMethod)
 {
     // scope is used to get to the execution context:
     return(new Proc(ProcKind.Block, null, context.EmptyScope,
                     BlockDispatcher.Create(parameterCount, signatureAttributes, null, 0).SetMethod(clrMethod)
                     ));
 }
Ejemplo n.º 12
0
        internal static BlockDispatcher/*!*/ Create(Delegate/*!*/ method, int parameterCount, BlockSignatureAttributes attributes) {
            if ((attributes & BlockSignatureAttributes.HasUnsplatParameter) == 0) {
                switch (parameterCount) {
                    case 0: return new BlockDispatcher0((BlockCallTarget0)method, attributes);
                    case 1: return new BlockDispatcher1((BlockCallTarget1)method, attributes);
                    case 2: return new BlockDispatcher2((BlockCallTarget2)method, attributes);
                    case 3: return new BlockDispatcher3((BlockCallTarget3)method, attributes);
                    case 4: return new BlockDispatcher4((BlockCallTarget4)method, attributes);
                    default: return new BlockDispatcherN((BlockCallTargetN)method, parameterCount, attributes);
                }
            }

            return new BlockDispatcherUnsplatN((BlockCallTargetUnsplatN)method, parameterCount, attributes);
        }
Ejemplo n.º 13
0
 internal static BlockSignatureAttributes MakeAttributes(BlockSignatureAttributes attributes, int arity) {
     return attributes | (BlockSignatureAttributes)(arity << 2);
 }
Ejemplo n.º 14
0
 internal BlockDispatcher(BlockSignatureAttributes attributesAndArity) {
     _attributesAndArity = attributesAndArity;
 }
Ejemplo n.º 15
0
        internal static BlockDispatcher/*!*/ Create(Delegate/*!*/ method, int parameterCount, BlockSignatureAttributes attributesAndArity) {
            if ((attributesAndArity & BlockSignatureAttributes.HasUnsplatParameter) == 0) {
                switch (parameterCount) {
                    case 0: return new BlockDispatcher0((BlockCallTarget0)method, attributesAndArity);
                    case 1: return new BlockDispatcher1((BlockCallTarget1)method, attributesAndArity);
                    case 2: return new BlockDispatcher2((BlockCallTarget2)method, attributesAndArity);
                    case 3: return new BlockDispatcher3((BlockCallTarget3)method, attributesAndArity);
                    case 4: return new BlockDispatcher4((BlockCallTarget4)method, attributesAndArity);
                    default: return new BlockDispatcherN((BlockCallTargetN)method, parameterCount, attributesAndArity);
                }
            }

            return new BlockDispatcherUnsplatN((BlockCallTargetUnsplatN)method, parameterCount, attributesAndArity);
        }
Ejemplo n.º 16
0
 internal static LambdaExpression/*!*/ CreateLambda(Expression body, string name, ReadOnlyCollection<ParameterExpression> parameters,
     int parameterCount, BlockSignatureAttributes attributes) {
     if ((attributes & BlockSignatureAttributes.HasUnsplatParameter) == 0) {
         switch (parameterCount) {
             case 0: return Ast.Lambda<BlockCallTarget0>(body, name, parameters);
             case 1: return Ast.Lambda<BlockCallTarget1>(body, name, parameters);
             case 2: return Ast.Lambda<BlockCallTarget2>(body, name, parameters);
             case 3: return Ast.Lambda<BlockCallTarget3>(body, name, parameters);
             case 4: return Ast.Lambda<BlockCallTarget4>(body, name, parameters);
             default: return Ast.Lambda<BlockCallTargetN>(body, name, parameters);
         }
     }
     return Ast.Lambda<BlockCallTargetUnsplatN>(body, name, parameters);
 }
Ejemplo n.º 17
0
        public static Proc/*!*/ DefineBlock(RubyScope/*!*/ scope, RuntimeFlowControl/*!*/ runtimeFlowControl, object self, Delegate/*!*/ clrMethod,
            int parameterCount, BlockSignatureAttributes attributesAndArity, string sourcePath, int startLine) {
            Assert.NotNull(scope, clrMethod);

            // closes block over self and context
            BlockDispatcher dispatcher = BlockDispatcher.Create(clrMethod, parameterCount, attributesAndArity);
            Proc result = new Proc(ProcKind.Block, self, scope, sourcePath, startLine, dispatcher);

            result.Owner = runtimeFlowControl;
            return result;
        }
Ejemplo n.º 18
0
 public BlockDispatcherN(int parameterCount, BlockSignatureAttributes attributesAndArity, string sourcePath, int sourceLine) 
     : base(attributesAndArity, sourcePath, sourceLine) {
     _parameterCount = parameterCount;
 }
Ejemplo n.º 19
0
 internal BlockDispatcher(BlockSignatureAttributes attributes) {
     _attributesAndArity = attributes;
 }
Ejemplo n.º 20
0
 public BlockDispatcher(BlockSignatureAttributes attributesAndArity, string sourcePath, int sourceLine)
     : base(attributesAndArity, sourcePath, sourceLine) {
 }
Ejemplo n.º 21
0
 public BlockDispatcher4(BlockSignatureAttributes attributesAndArity, string sourcePath, int sourceLine)
     : base(attributesAndArity, sourcePath, sourceLine)
 {
     Debug.Assert(!HasUnsplatParameter);
 }