예제 #1
0
        public BlockDispatcher0(BlockCallTarget0/*!*/ block, BlockSignatureAttributes attributes)
            : base(attributes) {
            Assert.NotNull(block);
            Debug.Assert(!HasUnsplatParameter);

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

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

            _parameterCount = parameterCount;
            _block = block;
        }
예제 #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;
        }
예제 #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;
        }
예제 #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);
 }
예제 #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);
 }
예제 #11
0
파일: Proc.cs 프로젝트: yyyyj/ironruby
 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)
                     ));
 }
예제 #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);
        }
예제 #13
0
 internal static BlockSignatureAttributes MakeAttributes(BlockSignatureAttributes attributes, int arity) {
     return attributes | (BlockSignatureAttributes)(arity << 2);
 }
예제 #14
0
 internal BlockDispatcher(BlockSignatureAttributes attributesAndArity) {
     _attributesAndArity = attributesAndArity;
 }
예제 #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);
        }
예제 #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);
 }
예제 #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;
        }
예제 #18
0
 public BlockDispatcherN(int parameterCount, BlockSignatureAttributes attributesAndArity, string sourcePath, int sourceLine) 
     : base(attributesAndArity, sourcePath, sourceLine) {
     _parameterCount = parameterCount;
 }
예제 #19
0
 internal BlockDispatcher(BlockSignatureAttributes attributes) {
     _attributesAndArity = attributes;
 }
예제 #20
0
 public BlockDispatcher(BlockSignatureAttributes attributesAndArity, string sourcePath, int sourceLine)
     : base(attributesAndArity, sourcePath, sourceLine) {
 }
예제 #21
0
 public BlockDispatcher4(BlockSignatureAttributes attributesAndArity, string sourcePath, int sourceLine)
     : base(attributesAndArity, sourcePath, sourceLine)
 {
     Debug.Assert(!HasUnsplatParameter);
 }