Esempio n. 1
0
        public override void InitBlock(
            CodegenBlock block,
            CodegenMethod methodNode,
            ExprForgeCodegenSymbol scope,
            CodegenClassScope codegenClassScope)
        {
            innerValue = InnerExpression.EvaluateCodegen(typeof(bool?), methodNode, scope, codegenClassScope);
            EnumTakeWhileHelper.InitBlockSizeOneScalar(numParameters, block, innerValue, InnerExpression.EvaluationType);
            block.DeclareVar(
                typeof(object[]),
                "all",
                StaticMethod(typeof(EnumTakeWhileHelper), "TakeWhileLastScalarToArray", EnumForgeCodegenNames.REF_ENUMCOLL));

            var forEach = block.ForLoop(
                typeof(int),
                "i",
                Op(ArrayLength(Ref("all")), "-", Constant(1)),
                Relational(Ref("i"), GE, Constant(0)),
                DecrementRef("i"))
                          .AssignArrayElement("props", Constant(0), ArrayAtIndex(Ref("all"), Ref("i")));

            if (numParameters >= 2)
            {
                forEach.IncrementRef("count")
                .AssignArrayElement("props", Constant(1), Ref("count"));
            }

            CodegenLegoBooleanExpression.CodegenBreakIfNotNullAndNotPass(forEach, InnerExpression.EvaluationType, innerValue);
            forEach.Expression(ExprDotMethod(Ref("result"), "AddFirst", ArrayAtIndex(Ref("all"), Ref("i"))));
        }
Esempio n. 2
0
 public override void InitBlock(
     CodegenBlock block,
     CodegenMethod methodNode,
     ExprForgeCodegenSymbol scope,
     CodegenClassScope codegenClassScope)
 {
     innerValue = InnerExpression.EvaluateCodegen(typeof(bool?), methodNode, scope, codegenClassScope);
     EnumTakeWhileHelper.InitBlockSizeOneEventPlus(numParameters, block, innerValue, StreamNumLambda, InnerExpression.EvaluationType);
 }