Package org.stjs.generator.javascript

Examples of org.stjs.generator.javascript.BinaryOperator


public class BinaryWriter<JS> implements WriterContributor<BinaryTree, JS> {
  @Override
  public JS visit(WriterVisitor<JS> visitor, BinaryTree tree, GenerationContext<JS> context) {
    JS left = visitor.scan(tree.getLeftOperand(), context);
    JS right = visitor.scan(tree.getRightOperand(), context);
    BinaryOperator op = BinaryOperator.valueOf(tree.getKind());
    assert op != null : "Unknow operator:" + tree.getKind();

    @SuppressWarnings("unchecked")
    JS expr = context.js().binary(op, Arrays.asList(left, right));
View Full Code Here


  protected JS doVisit(WriterVisitor<JS> visitor, UnaryTree tree, GenerationContext<JS> context, boolean global) {
    UnaryOperator op = UnaryOperator.valueOf(tree.getKind());
    assert op != null : "Unknow operator:" + tree.getKind();

    BinaryOperator binaryOp = getBinaryOperator(op);

    if (binaryOp == null) {
      return super.visit(visitor, tree, context);
    }
View Full Code Here

public class ReplaceBinaryWriter<JS> implements WriterContributor<BinaryTree, JS> {
  @Override
  public JS visit(WriterVisitor<JS> visitor, BinaryTree tree, GenerationContext<JS> context) {
    JS left = visitor.scan(tree.getLeftOperand(), context);
    // JS right = visitor.scan(tree.getRightOperand(), context);
    BinaryOperator op = BinaryOperator.valueOf(tree.getKind());
    assert op != null : "Unknow operator:" + tree.getKind();

    @SuppressWarnings("unchecked")
    // replaces on purpose the second operand at 2
    JS expr = context.js().binary(op, Arrays.asList(left, context.js().number(2)));
View Full Code Here

TOP

Related Classes of org.stjs.generator.javascript.BinaryOperator

Copyright © 2018 www.massapicom. 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.