Exemplo 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));
            }
        }
Exemplo 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()));
        }
Exemplo n.º 3
0
        public ExpressionList Optimize(OptimizationParams op)
        {
            ExpressionList r = new ExpressionList();

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