예제 #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()));
            }
예제 #2
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public ElemGen(StmtGen gen)
 {
     Contract.Requires <ArgumentNullException>(gen != null);
     StmtGen = gen;
 }
예제 #3
0
            // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====

            public DefunGen(StmtGen parent) : base(parent)
            {
            }
예제 #4
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public BlockGen(StmtGen parent)
 {
     _parent = parent;
 }
예제 #5
0
            // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====

            public LambdaGen(StmtGen gen) : base(gen)
            {
            }
예제 #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);
 }
예제 #7
0
 protected SyntaxException Error(string message, TextLocation location)
 {
     return(StmtGen.Error(message, location));
 }
예제 #8
0
 private Expression GenSymbol(Symbol elem)
 {
     Contract.Requires <ArgumentNullException>(elem != null);
     Contract.Ensures(Contract.Result <Expression>() != null);
     return(StmtGen.GetValue(elem.Name));
 }
예제 #9
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public LambdaGen(StmtGen gen)
     : base(gen)
 {
 }
예제 #10
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public BlockGen(StmtGen parent)
 {
     _parent = parent;
 }
예제 #11
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public ElemGen(StmtGen gen)
 {
     Contract.Requires<ArgumentNullException>(gen != null);
     StmtGen = gen;
 }
예제 #12
0
 // ===== ===== ===== ===== ===== ctor ===== ===== ===== ===== =====
 public DefunGen(StmtGen parent)
     : base(parent)
 {
 }