Package org.stjs.generator.javascript

Examples of org.stjs.generator.javascript.AssignOperator


    return doVisit(visitor, tree, context, false);
  }

  @SuppressWarnings("PMD.CompareObjectsWithEquals")
  protected JS doVisit(WriterVisitor<JS> visitor, CompoundAssignmentTree tree, GenerationContext<JS> context, boolean global) {
    AssignOperator op = AssignOperator.valueOf(tree.getKind());
    assert op != null : "Unknown operator:" + tree.getKind();

    JS left = visitor.scan(tree.getVariable(), context);
    JS right = visitor.scan(tree.getExpression(), context);
    JS modifiedRight = DefaultCompoundAssignmentTemplate.rightSide(left, right, tree, context);
    JS value;
    if (modifiedRight == right) {
      value = context.js().binary(op.getBinaryOperator(), Arrays.asList(left, context.js().paren(right)));
    } else {
      value = modifiedRight;
    }

    TreeWrapper<ExpressionTree, JS> leftSide = context.getCurrentWrapper().child(tree.getVariable());
View Full Code Here

TOP

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

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.