Examples of BinaryOp


Examples of loop.ast.BinaryOp

        Computation computation = new Computation();
        computation.add(reduceNode(list.children().get(1)));

        // Add binary op chain.
        for (int i = 2; i < list.children().size(); i++) {
          BinaryOp op = new BinaryOp(new Token(var.name, kind, var.sourceLine, var.sourceColumn));
          op.add(reduceNode(list.children().get(i)));
          computation.add(op);
        }

        return computation;
    }

    TernaryIfExpression ifExpression = new TernaryIfExpression();
    Computation test = new Computation();
    test.add(var);
    test.add(new BinaryOp(new Token("in", Token.Kind.IN, var.sourceLine, var.sourceColumn))
        .add(new JavaLiteral('"' + Closure.class.getName() + '"')));
    ifExpression.add(test);                               // test := var instanceof closure
    ifExpression.add(toFunctionCall(var, list));          // then call
    ifExpression.add(var);                                // else return as is
View Full Code Here

Examples of org.openquark.cal.compiler.SourceModel.Expr.BinaryOp

                        isRedundant = false;
                    }
                }
               
            } else if(lambdaExp instanceof BinaryOp) {
                BinaryOp definingExpr = (BinaryOp)lambdaExp;
               
                if(lambda.getNParameters() == 2 &&
                   isParameterVar(lambda.getNthParameter(0), definingExpr.getLeftExpr()) &&
                   isParameterVar(lambda.getNthParameter(1), definingExpr.getRightExpr())) {
                   
                    isRedundant = true;
                   
                } else if(lambda.getNParameters() == 1 &&
                   isParameterVar(lambda.getNthParameter(0), definingExpr.getRightExpr()) &&
                   !containsParameterReference(lambda.getNthParameter(0), definingExpr.getLeftExpr())) {
                   
                    isRedundant = true;
                }
           
            } else if(lambdaExp instanceof UnaryOp) {
                UnaryOp definingExpr = (UnaryOp)lambdaExp;
                if(lambda.getNParameters() == 1 &&
                   isParameterVar(lambda.getNthParameter(0), definingExpr.getExpr())) {
                   
                    isRedundant = true;
                }
            }
           
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.