Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.MethodDeclaration


    "}";
 
  @Test
  public void testSimpleCall() throws Exception {
    CompilationUnit simple = EclipseTACSimpleTestDriver.parseCode("SimpleCall", SIMPLE_CALL);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(simple);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    MethodInvocation invoke = (MethodInvocation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(invoke);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof MethodCallInstruction);
    MethodCallInstruction call = (MethodCallInstruction) instr;
    Assert.assertNull(((ThisVariable) tac.implicitThisVariable(m.resolveBinding())).getQualifier());
    Assert.assertEquals(tac.implicitThisVariable(m.resolveBinding()), call.getReceiverOperand());
    EclipseTACSimpleTestDriver.assertOperands(invoke.arguments(), call.getArgOperands(), tac);
    Assert.assertTrue(call.getArgOperands().get(0) instanceof SourceVariable);
    Assert.assertEquals(
        tac.sourceVariable(((SingleVariableDeclaration) m.parameters().get(0)).resolveBinding()),
        call.getArgOperands().get(0));
  }
View Full Code Here


    "}";
 
  @Test
  public void testStaticCall() throws Exception {
    CompilationUnit simple = EclipseTACSimpleTestDriver.parseCode("StaticCall", STATIC_CALL);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(simple);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    MethodInvocation invoke = (MethodInvocation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(invoke);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof MethodCallInstruction);
    MethodCallInstruction call = (MethodCallInstruction) instr;
    Assert.assertEquals(tac.typeVariable(m.resolveBinding().getDeclaringClass()), call.getReceiverOperand());
    EclipseTACSimpleTestDriver.assertOperands(invoke.arguments(), call.getArgOperands(), tac);
    Assert.assertTrue(call.getArgOperands().get(0) instanceof SourceVariable);
    Assert.assertEquals(
        tac.sourceVariable(((SingleVariableDeclaration) m.parameters().get(0)).resolveBinding()),
        call.getArgOperands().get(0));
  }
View Full Code Here

    "}";
 
  @Test
  public void testSimpleReturn() throws Exception {
    CompilationUnit simple = EclipseTACSimpleTestDriver.parseCode("SimpleReturn", SIMPLE_RETURN);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(simple);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ReturnStatement ret = (ReturnStatement) EclipseTACSimpleTestDriver.getLastStatementReturn(m);
    Assert.assertTrue(ret.getExpression() != null);
    TACInstruction instr = tac.instruction(ret);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof ReturnInstruction);
View Full Code Here

    methods = CFGTestUtils.createMethodNameMap(compUnit);
  }

  @Test
  public void simpleTest() throws Exception {
    MethodDeclaration decl = methods.get("simple");
    Assert.assertTrue(CFGTestUtils.testAndCompareCFG(decl));
  }
View Full Code Here

    }
  }

  @Test
  public void breakingTest() throws Exception {
    MethodDeclaration decl = methods.get("breaking");
    Assert.assertTrue(CFGTestUtils.testAndCompareCFG(decl));
  }
View Full Code Here

    }
  }

  @Test
  public void continuingTest() throws Exception {
    MethodDeclaration decl = methods.get("continuing");
    Assert.assertTrue(CFGTestUtils.testAndCompareCFG(decl));
  }
View Full Code Here

    }
  }

  @Test
  public void returningTest() throws Exception {
    MethodDeclaration decl = methods.get("returning");
    Assert.assertTrue(CFGTestUtils.testAndCompareCFG(decl));
  }
View Full Code Here

    methods = CFGTestUtils.createMethodNameMap(compUnit);
  }

  @Test
  public void simpleTest() throws Exception {
    MethodDeclaration decl = methods.get("simple");
    Assert.assertTrue(CFGTestUtils.testAndCompareCFG(decl));
  }
View Full Code Here

    } while (cond);
  }

  @Test
  public void breakingTest() throws Exception {
    MethodDeclaration decl = methods.get("breaking");
    Assert.assertTrue(CFGTestUtils.testAndCompareCFG(decl));
  }
View Full Code Here

    } while (!cond);
  }

  @Test
  public void continuingTest() throws Exception {
    MethodDeclaration decl = methods.get("continuing");
    Assert.assertTrue(CFGTestUtils.testAndCompareCFG(decl));
  }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.MethodDeclaration

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.