Package org.eclipse.jdt.core.dom

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


    "class Outer { }";
 
  @Test
  public void testInner() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("Outer", INNER);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
View Full Code Here


    "}";
 
  @Test
  public void testExplicitInner() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("OuterExplicit", EXPLICIT_INNER);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
View Full Code Here

    "}";
 
  @Test
  public void testStaticInner() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("OuterStaticInner", STATIC_INNER);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
View Full Code Here

    "}";
 
  @Test
  public void testLocal() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("OuterLocal", LOCAL);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
View Full Code Here

    "}";
 
  @Test
  public void testAnonymous() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("OuterAnon", ANON);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    ClassInstanceCreation instance = (ClassInstanceCreation) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(instance);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof NewObjectInstruction);
    NewObjectInstruction newobj = (NewObjectInstruction) instr;
View Full Code Here

 
  public IResult<LE> getLabeledResultsAfter(ASTNode node) {
    /*
     * TODO: Need a find a way to get rid of this call...
     */
    MethodDeclaration decl = Utilities.getMethodDeclaration(node);
   
    if( decl!= null && this.analyzedMethods.containsKey(decl) ) {
      try {
        return this.analyzedMethods.get(decl).get().getLabeledResultsAfter(node);
      } catch (Exception e) {/* Do nothing, let fall through to default. */ }
View Full Code Here

    }
    return addAsFakeFuture(decl,defaultFlowAnalysis).getLabeledResultsAfter(node);
  }

  public IResult<LE> getLabeledResultsBefore(ASTNode node) {
    MethodDeclaration decl = Utilities.getMethodDeclaration(node);
   
    if( decl!= null && this.analyzedMethods.containsKey(decl) ) {
      try {
        return this.analyzedMethods.get(decl).get().getLabeledResultsBefore(node);
      } catch (Exception e) {/* Do nothing, let fall through to default. */ }
View Full Code Here

    }
    return addAsFakeFuture(decl,defaultFlowAnalysis).getLabeledResultsBefore(node);
  }

  public LE getResultsAfter(ASTNode node) {
    MethodDeclaration decl = Utilities.getMethodDeclaration(node);
   
    if( decl!= null && this.analyzedMethods.containsKey(decl) ) {
      try {
        return this.analyzedMethods.get(decl).get().getResultsAfter(node);
      } catch (Exception e) {/* Do nothing, let fall through to default. */ }
View Full Code Here

    }
    return addAsFakeFuture(decl,defaultFlowAnalysis).getResultsAfter(node);
  }

  public LE getResultsBefore(ASTNode node) {
    MethodDeclaration decl = Utilities.getMethodDeclaration(node);
   
    if( decl!= null && this.analyzedMethods.containsKey(decl) ) {
      try {
        return this.analyzedMethods.get(decl).get().getResultsBefore(node);
      } catch (Exception e) {/* Do nothing, let fall through to default. */ }
View Full Code Here

public class EclipseTACFieldTest {

  @Test
  public void testReadField() throws Exception {
    CompilationUnit cu = EclipseTACSimpleTestDriver.parseCode("FieldRead", FIELD_READ);
    MethodDeclaration m = EclipseTACSimpleTestDriver.getFirstMethod(cu);
    EclipseTAC tac = new EclipseTAC(m.resolveBinding());
    Expression read = (Expression) EclipseTACSimpleTestDriver.getLastStatementReturn(m).getExpression();
    TACInstruction instr = tac.instruction(read);
    Assert.assertTrue(instr != null);
    Assert.assertTrue(instr instanceof LoadFieldInstruction);
    LoadFieldInstruction load = (LoadFieldInstruction) instr;
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.