Esempio n. 1
0
        public override IEnumerable <NodeBase> Expand(Context ctx, NodeBase expression, Label nextStatement)
        {
            foreach (var rule in KeyRule.Expand(ctx, Expr.GetMember(expression, "Key"), nextStatement))
            {
                yield return(rule);
            }

            foreach (var rule in ValueRule.Expand(ctx, Expr.GetMember(expression, "Value"), nextStatement))
            {
                yield return(rule);
            }
        }
Esempio n. 2
0
        public override IEnumerable <NodeBase> Expand(Context ctx, NodeBase expression, Label nextStatement)
        {
            // no need for temporary variable: field access is idempotent
            yield return(MakeJumpIf(
                             nextStatement,
                             Expr.Not(
                                 Expr.Is(expression, _type)
                                 )
                             ));

            var rules = LabelRule.Expand(
                ctx,
                Expr.GetMember(
                    Expr.Cast(expression, _type),
                    "Tag"
                    ),
                nextStatement
                );

            foreach (var rule in rules)
            {
                yield return(rule);
            }
        }