Examples of BooleanLiteral


Examples of com.google.dart.engine.ast.BooleanLiteral

    if (nodeExits(conditionExpression)) {
      return true;
    }
    // TODO(jwren) Do we want to take all constant expressions into account?
    if (conditionExpression instanceof BooleanLiteral) {
      BooleanLiteral booleanLiteral = (BooleanLiteral) conditionExpression;
      if (booleanLiteral.getValue()) {
        // if(true) ...
        return nodeExits(thenStatement);
      } else if (elseStatement != null) {
        // if (false) ...
        return nodeExits(elseStatement);
View Full Code Here

Examples of com.google.dart.engine.ast.BooleanLiteral

      if (conditionExpression.accept(this)) {
        return true;
      }
      // TODO(jwren) Do we want to take all constant expressions into account?
      if (conditionExpression instanceof BooleanLiteral) {
        BooleanLiteral booleanLiteral = (BooleanLiteral) conditionExpression;
        // If while(true), and the body doesn't return or the body doesn't have a break, then return
        // true.
        boolean blockReturns = node.getBody().accept(this);
        if (booleanLiteral.getValue() && (blockReturns || !enclosingBlockContainsBreak)) {
          return true;
        }
      }
      return false;
    } finally {
View Full Code Here

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

      readToken(Token.KEYWORD_NULL);
      return new NullLiteral();

    } else if (nextToken == Token.KEYWORD_TRUE) {
      readToken(Token.KEYWORD_TRUE);
      return new BooleanLiteral(true);

    } else if (nextToken == Token.KEYWORD_FALSE) {
      readToken(Token.KEYWORD_FALSE);
      return new BooleanLiteral(false);

    } else if (nextToken == Token.OPERATOR_OPENPAREN) {
      readToken(Token.OPERATOR_OPENPAREN);
      Expression expression = parseExpression(true);
      readToken(Token.OPERATOR_CLOSEPAREN);
View Full Code Here

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

  }

  public void testIfStatement() throws CompilerException {
    assertParserOutput(
        new IfStatement(
            new BooleanLiteral(true),
            new ExpressionStatement(
                new Identifier("foo")
            ),
            null
        ),
        "if (true) foo;"
    );
    assertParserOutput(
        new IfStatement(
            new BooleanLiteral(true),
            new ExpressionStatement(
                new Identifier("foo")
            ),
            new ExpressionStatement(
                new Identifier("bar")
            )
        ),
        "if (true) foo; else bar;"
    );
    assertParserOutput(
        new IfStatement(
            new BooleanLiteral(true),
            new IfStatement(
                new BooleanLiteral(true),
                new ExpressionStatement(
                    new Identifier("foo")
                ),
                new ExpressionStatement(
                    new Identifier("bar")
                )
            ),
            null
        ),
        "if (true) if (true) foo; else bar;"
    );
    assertParserOutput(
        new IfStatement(
            new BooleanLiteral(true),
            new IfStatement(
                new BooleanLiteral(true),
                new ExpressionStatement(
                    new Identifier("foo")
                ),
                new ExpressionStatement(
                    new Identifier("bar")
View Full Code Here

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

    assertParserOutput(
        new DoStatement(
            new ExpressionStatement(
                new Identifier("something")
            ),
            new BooleanLiteral(true)
        ),
        "do something; while (true);"
    );
    assertParserOutput(
        new DoStatement(
            new BlockStatement(
                new Statement[] {
                    new ExpressionStatement(
                        new Identifier("something")
                    )
                }
            ),
            new BooleanLiteral(true)
        ),
        "do {something;} while (true);"
    );
  }
View Full Code Here

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

  }

  public void testBooleanLiteral() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new BooleanLiteral(true)
        ),
        "true;"
    );
    assertParserOutput(
        new ExpressionStatement(
            new BooleanLiteral(false)
        ),
        "false;"
    );
  }
View Full Code Here

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

  }

  public void testThrowStatement() throws CompilerException {
    assertParserOutput(
        new ThrowStatement(
            new BooleanLiteral(true)
        ),
        "throw true;"
    );
    assertParserOutput(
        new ThrowStatement(
View Full Code Here

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

        new LabelledStatement(
            new Identifier("foo"),
            new LabelledStatement(
                new Identifier("bar"),
                new WhileStatement(
                    new BooleanLiteral(true),
                    new BlockStatement(
                        new Statement[] {
                            new ExpressionStatement(
                                new Identifier("baz")
                            )
View Full Code Here

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

        ),
        "return 0;"
    );
    assertParserOutput(
        new ReturnStatement(
            new BooleanLiteral(true)
        ),
        "return true;"
    );
  }
View Full Code Here

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

  }

  public void testWhileStatement() throws CompilerException {
    assertParserOutput(
        new WhileStatement(
            new BooleanLiteral(true),
            new ExpressionStatement(
                new Identifier("something")
            )
        ),
        "while (true) something;"
    );
    assertParserOutput(
        new WhileStatement(
            new BooleanLiteral(true),
            new BlockStatement(
                new Statement[] {
                    new ExpressionStatement(
                        new Identifier("something")
                    )
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.