Пример #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));
            }
        }
Пример #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()));
        }
Пример #3
0
        public ExpressionList Optimize(OptimizationParams op)
        {
            ExpressionList r = new ExpressionList();

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