Package com.google.minijoe.compiler.ast

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


        expression = new CallExpression(expression, arguments);
      } else if (nextToken == Token.OPERATOR_OPENSQUARE) {
        readToken(Token.OPERATOR_OPENSQUARE);
        Expression property = parseExpression(true);
        readToken(Token.OPERATOR_CLOSESQUARE);
        expression = new PropertyExpression(expression, property);
      } else if (nextToken == Token.OPERATOR_DOT) {
        // transform x.bar to x["bar"]
        readToken(Token.OPERATOR_DOT);
        Identifier identifier = parseIdentifier();
        expression = new PropertyExpression(expression, new StringLiteral(identifier.string));
      } else {
        return expression;
      }
    }
  }
View Full Code Here


  }

  public Expression visit(CallExpression expression) throws CompilerException {

    if (expression.function instanceof PropertyExpression) {
      PropertyExpression pe = (PropertyExpression) expression.function;
      pe.leftExpression.visitExpression(this);
      writeOp(JsFunction.OP_DUP);
      pe.rightExpression.visitExpression(this);
      writeOp(JsFunction.OP_GET);
    } else {
View Full Code Here

        ),
        "for (foo in [1, 2, 3, 4]);"
    );
    assertParserOutput(
        new ForInStatement(
            new PropertyExpression(
                new Identifier("foo"),
                new StringLiteral("bar")
            ),
            new ArrayLiteral(
                new Expression[] {
View Full Code Here

        "foo++;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new PropertyExpression(
                    new Identifier("foo"),
                    new StringLiteral("bar")
                ),
                1,
                true
View Full Code Here

        "foo--;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new IncrementExpression(
                new PropertyExpression(
                    new Identifier("foo"),
                    new StringLiteral("bar")
                ),
                -1,
                true
View Full Code Here

  }

  public void testPropertyExpression() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new PropertyExpression(
                new Identifier("foo"),
                new StringLiteral("bar")
            )
        ),
        "foo.bar;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new PropertyExpression(
                new Identifier("foo"),
                new StringLiteral("bar")
            )
        ),
        "foo[\"bar\"];"
View Full Code Here

  }

  public void testExpressionStatement() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new PropertyExpression(
                new NewExpression(
                    new PropertyExpression(
                        new NewExpression(
                            new Identifier("foo"),
                            new Expression[] {
                              new Identifier("String"),
                              new NumberLiteral(2.0)
View Full Code Here

TOP

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

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.