Examples of ReturnStatement


Examples of anvil.script.statements.ReturnStatement

    } else {
      if (expression == null) {
        expression = Expression.UNDEFINED;
      }
    }
    stmt = new ReturnStatement(flowPeek(), toLocation(t), expression);
    StatementModifier(stmt);
  }
View Full Code Here

Examples of com.bacoder.parser.java.api.ReturnStatement

    return ifStatement;
  }

  protected ReturnStatement processReturnStatement(StatementContext context) {
    ReturnStatement returnStatement = createNode(context, ReturnStatement.class);

    ExpressionContext expressionContext = getChild(context, ExpressionContext.class);
    if (expressionContext != null) {
      returnStatement.setExpression(getAdapter(ExpressionAdapter.class).adapt(expressionContext));
    }

    return returnStatement;
  }
View Full Code Here

Examples of com.dragome.compiler.ast.ReturnStatement

      body.removeChild(body.getFirstChild());

      MethodInvocation consume= (MethodInvocation) body.getLastChild();
      body.removeChild(consume);

      ReturnStatement r= new ReturnStatement(0, 0);
      r.setExpression((Expression) consume.getArguments().get(0));
      body.appendChild(r);

      print("_dragomeJs.StringInit" + signatureReplaced + " = function(");
      closingString= "};\n";
    }
View Full Code Here

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

      result = parseExpression(true);
    }

    readTokenSemicolon();

    return new ReturnStatement(result);
  }
View Full Code Here

Examples of com.google.test.metric.cpp.dom.ReturnStatement

    finished();
  }

  @Override
  public void beginReturnStatement(int line) {
    Node node = new ReturnStatement(line);
    parent.addChild(node);
    pushBuilder(new StatementBuilder(node));
  }
View Full Code Here

Examples of com.google.test.metric.cpp.dom.ReturnStatement

  public void testSimpleFunction() throws Exception {
    TranslationUnit unit = parse("int foo() { int a = 0; a = a + 1;\n return a; }");
    FunctionDefinition functionFoo = unit.getChild(0);
    assertEquals("foo", functionFoo.getName());
    ReturnStatement returnStatement = functionFoo.getChild(2);
    assertNotNull(returnStatement);
    assertEquals(2, returnStatement.getLineNumber());
  }
View Full Code Here

Examples of com.google.test.metric.cpp.dom.ReturnStatement

  public void testFunctionWithParameters() throws Exception {
    TranslationUnit unit = parse("int foo(int a, int b) { return a + b; }");
    FunctionDefinition functionFoo = unit.getChild(0);
    assertEquals("foo", functionFoo.getName());
    ReturnStatement returnStatement = functionFoo.getChild(0);
    assertNotNull(returnStatement);
    List<ParameterInfo> parameters = functionFoo.getParameters();
    assertEquals(2, parameters.size());
    ParameterInfo parameterA = parameters.get(0);
    assertEquals("a", parameterA.getName());
View Full Code Here

Examples of com.google.test.metric.cpp.dom.ReturnStatement

  }

  public void testTernaryOperator() throws Exception {
    TranslationUnit unit = parse("int foo(int a, int b) { return a ? 0 : b; }");
    FunctionDefinition functionFoo = unit.getChild(0);
    ReturnStatement returnStatement = functionFoo.getChild(0);
    TernaryOperation ternaryOperation = returnStatement.getExpression(0);
    assertNotNull(ternaryOperation);
  }
View Full Code Here

Examples of com.google.test.metric.cpp.dom.ReturnStatement

    TranslationUnit unit = parse(
        "int foo(int a) { return a; }             " +
        "int bar(int b) { return foo(foo(b)); }   ");
    FunctionDefinition functionBar = unit.getChild(1);
    assertEquals("bar", functionBar.getName());
    ReturnStatement returnStatement = functionBar.getChild(0);
    FunctionInvocation callFoo = returnStatement.getExpression(0);
    assertEquals("foo", callFoo.getName());
    NodeList parameters = callFoo.getParameters();
    FunctionInvocation callFooAgain = parameters.get(0);
    assertEquals("foo", callFooAgain.getName());
    assertEquals(0, callFooAgain.getChildren().size());
View Full Code Here

Examples of org.allspice.structured.statement.ReturnStatement

    TryFinally obj = makeObject(TryFinally.class,new TryCatchStatement(
        new FIFO<Statement>(new ThrowStatement(ARG0,null)),
        new FIFO<CatchBlock>(new CatchBlock(
            new VarDecl("java.lang.Exception","ex"),
            new FIFO<Statement>(
                new ReturnStatement(new ConstExpr(Integer.valueOf(1),null),null)
            )
            )),
        new FIFO<Statement>(),null)) ;

    assertEquals(obj.meth(new Exception()),1) ;
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.