Package com.google.minijoe.compiler.ast

Examples of com.google.minijoe.compiler.ast.AssignmentOperatorExpression


            || nextToken == Token.OPERATOR_BITWISEANDASSIGNMENT
            || nextToken == Token.OPERATOR_BITWISEORASSIGNMENT
            || nextToken == Token.OPERATOR_BITWISEXORASSIGNMENT) {
      Token op = nextToken;
      readToken();
      return new AssignmentOperatorExpression(left, parseAssignmentExpression(inFlag), op);
    } else {
      return left;
    }
  }
View Full Code Here


      // push property
      expression.rightExpression.visitExpression(this);
      writeOp(JsFunction.OP_SET);
    } else if (pa instanceof AssignmentOperatorExpression) {
      // this case is a bit tricky...
      AssignmentOperatorExpression aoe = (AssignmentOperatorExpression) pa;
      expression.leftExpression.visitExpression(this);
      expression.rightExpression.visitExpression(this);
      // duplicate object and member
      writeOp(JsFunction.OP_DDUP);
      writeOp(JsFunction.OP_GET);
View Full Code Here

  }

  public void testMultiplyAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_MULTIPLYASSIGNMENT
            )
        ),
        "foo *= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_MULTIPLYASSIGNMENT
                ),
                Token.OPERATOR_MULTIPLYASSIGNMENT
            )
        ),
        "foo *= bar *= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
                    Token.OPERATOR_PLUS
View Full Code Here

  }

  public void testDivideAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_DIVIDEASSIGNMENT
            )
        ),
        "foo /= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_DIVIDEASSIGNMENT
                ),
                Token.OPERATOR_DIVIDEASSIGNMENT
            )
        ),
        "foo /= bar /= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
                    Token.OPERATOR_PLUS
View Full Code Here

  }

  public void testModuloAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_MODULOASSIGNMENT
            )
        ),
        "foo %= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_MODULOASSIGNMENT
                ),
                Token.OPERATOR_MODULOASSIGNMENT
            )
        ),
        "foo %= bar %= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
                    Token.OPERATOR_PLUS
View Full Code Here

  }

  public void testAdditionAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_PLUSASSIGNMENT
            )
        ),
        "foo += bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_PLUSASSIGNMENT
                ),
                Token.OPERATOR_PLUSASSIGNMENT
            )
        ),
        "foo += bar += baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
                    Token.OPERATOR_PLUS
View Full Code Here

  }

  public void testSubtractionAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_MINUSASSIGNMENT
            )
        ),
        "foo -= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_MINUSASSIGNMENT
                ),
                Token.OPERATOR_MINUSASSIGNMENT
            )
        ),
        "foo -= bar -= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
                    Token.OPERATOR_PLUS
View Full Code Here

  }

  public void testShiftLeftAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_SHIFTLEFTASSIGNMENT
            )
        ),
        "foo <<= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_SHIFTLEFTASSIGNMENT
                ),
                Token.OPERATOR_SHIFTLEFTASSIGNMENT
            )
        ),
        "foo <<= bar <<= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
                    Token.OPERATOR_PLUS
View Full Code Here

  }

  public void testShiftRightAssignmentExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_SHIFTRIGHTASSIGNMENT
            )
        ),
        "foo >>= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_SHIFTRIGHTASSIGNMENT
                ),
                Token.OPERATOR_SHIFTRIGHTASSIGNMENT
            )
        ),
        "foo >>= bar >>= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
                    Token.OPERATOR_PLUS
View Full Code Here

  }

  public void testShiftRightUnsignedExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new Identifier("bar"),
                Token.OPERATOR_SHIFTRIGHTUNSIGNEDASSIGNMENT
            )
        ),
        "foo >>>= bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new AssignmentOperatorExpression(
                    new Identifier("bar"),
                    new Identifier("baz"),
                    Token.OPERATOR_SHIFTRIGHTUNSIGNEDASSIGNMENT

                ),
                Token.OPERATOR_SHIFTRIGHTUNSIGNEDASSIGNMENT
            )
        ),
        "foo >>>= bar >>>= baz;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new AssignmentOperatorExpression(
                new Identifier("foo"),
                new BinaryOperatorExpression(
                    new Identifier("bar"),
                    new NumberLiteral(1.0),
                    Token.OPERATOR_PLUS
View Full Code Here

TOP

Related Classes of com.google.minijoe.compiler.ast.AssignmentOperatorExpression

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.