Esempio n. 1
0
        public override Expression Optimize(OptimizationParams op)
        {
            Expression opt_rvalue = rvalue.Optimize(op);

            if (lvalue is Name)
            {
                Name     nm  = lvalue as Name;
                Accessor acc = op.GetAccessor(nm.name);
                if (acc == null)
                {
                    return(this);
                }
                else
                {
                    return(new OptimizedExpression((VM vm) =>
                    {
                        HeronValue x = opt_rvalue.Eval(vm);
                        acc.Set(x);
                        return x;
                    }));
                }
            }
            else
            {
                return(new Assignment(lvalue.Optimize(op), opt_rvalue));
            }
        }
Esempio n. 2
0
        public override Expression Optimize(OptimizationParams op)
        {
            Accessor acc = op.GetAccessor(name);

            if (acc == null)
            {
                return(this);
            }
            return(new OptimizedExpression((VM vm) => acc.Get()));
        }
Esempio n. 3
0
        public ExpressionList Optimize(OptimizationParams op)
        {
            ExpressionList r = new ExpressionList();

            foreach (Expression x in this)
            {
                r.Add(x.Optimize(op));
            }
            return(r);
        }
Esempio n. 4
0
 public override Expression Optimize(OptimizationParams op)
 {
     return(this);
 }
Esempio n. 5
0
 public override Expression Optimize(OptimizationParams op)
 {
     return(new TupleExpr(exprs.Optimize(op)));
 }
Esempio n. 6
0
 public override Expression Optimize(OptimizationParams op)
 {
     return(new PostIncExpr(expr.Optimize(op)));
 }
Esempio n. 7
0
 public override Expression Optimize(OptimizationParams op)
 {
     return(new UnaryOperation(operation, operand.Optimize(op)));
 }
Esempio n. 8
0
 public override Expression Optimize(OptimizationParams op)
 {
     return(new FunCall(funexpr.Optimize(op), args.Optimize(op)));
 }
Esempio n. 9
0
 public override Expression Optimize(OptimizationParams op)
 {
     return(new NewExpr(type, args.Optimize(op), module));
 }
Esempio n. 10
0
 public override Expression Optimize(OptimizationParams op)
 {
     return(new ReadAt(self.Optimize(op), index.Optimize(op)));
 }
Esempio n. 11
0
 public override Expression Optimize(OptimizationParams op)
 {
     return(new ChooseField(self.Optimize(op), name));
 }
Esempio n. 12
0
 public abstract Expression Optimize(OptimizationParams op);
Esempio n. 13
0
 public override Expression Optimize(OptimizationParams op)
 {
     return(new ParanthesizedExpr(expr.Optimize(op)));
 }
Esempio n. 14
0
 public override Expression Optimize(OptimizationParams op)
 {
     return(new RecordExpr(fields.Optimize(op), fielddefs));
 }