Esempio n. 1
0
            // ===== ===== ===== ===== ===== method ===== ===== ===== ===== =====

            public LambdaExpression Generate(Lambda lambda)
            {
                Contract.Requires <ArgumentNullException>(lambda != null);
                Contract.Ensures(Contract.Result <LambdaExpression>() != null);
                var expr = GenElem(lambda.Element);
                var tmp  = Expression.Parameter(expr.Type);
                var body = Expression.Block(
                    new[] { tmp },
                    StmtGen.DebugInfo(lambda.Range),
                    Expression.Assign(tmp, expr),
                    StmtGen.ClearInfo(),
                    tmp);

                return(Expression.Lambda(body, ParamList.ToEnum(_params).Reverse()));
            }
Esempio n. 2
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public ElemGen(StmtGen gen)
 {
     Contract.Requires <ArgumentNullException>(gen != null);
     StmtGen = gen;
 }
Esempio n. 3
0
            // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====

            public DefunGen(StmtGen parent) : base(parent)
            {
            }
Esempio n. 4
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public BlockGen(StmtGen parent)
 {
     _parent = parent;
 }
Esempio n. 5
0
            // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====

            public LambdaGen(StmtGen gen) : base(gen)
            {
            }
Esempio n. 6
0
 protected virtual Expression GenLambdaParam(LambdaParameter elem)
 {
     Contract.Requires <ArgumentNullException>(elem != null);
     Contract.Ensures(Contract.Result <Expression>() != null);
     throw StmtGen.Error("ラムダパラメタはラムダ式の内部でのみ利用出来ます。", elem.Range.Start);
 }
Esempio n. 7
0
 protected SyntaxException Error(string message, TextLocation location)
 {
     return(StmtGen.Error(message, location));
 }
Esempio n. 8
0
 private Expression GenSymbol(Symbol elem)
 {
     Contract.Requires <ArgumentNullException>(elem != null);
     Contract.Ensures(Contract.Result <Expression>() != null);
     return(StmtGen.GetValue(elem.Name));
 }
Esempio n. 9
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public LambdaGen(StmtGen gen)
     : base(gen)
 {
 }
Esempio n. 10
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public BlockGen(StmtGen parent)
 {
     _parent = parent;
 }
Esempio n. 11
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public ElemGen(StmtGen gen)
 {
     Contract.Requires<ArgumentNullException>(gen != null);
     StmtGen = gen;
 }
Esempio n. 12
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public DefunGen(StmtGen parent)
     : base(parent)
 {
 }