Package org.eclipse.php.internal.core.ast.nodes

Examples of org.eclipse.php.internal.core.ast.nodes.MethodDeclaration


    anotherChange.addTextEditGroup(newMethodEdit);
    anotherChange.addTextEditGroup(inlineReplacementEdit);
    anotherChange.addTextEditGroup(additionalInlineReplacementEdit);
   
    AST ast = fProgram.getAST();
    MethodDeclaration method = ast.newMethodDeclaration();
    Block extractedMethodBody = ast.newBlock();
       
    FunctionDeclaration functionDec = ast.newFunctionDeclaration(ast.newIdentifier(fMethodName), computeArguments(ast), extractedMethodBody, false);
    method.setModifier(fModifierAccessFlag);
    method.setFunction(functionDec);
   
    ASTRewrite rewriter = ASTRewrite.create(ast);
   
    ListRewrite classListRewrite = rewriter.getListRewrite( fCoveringDeclarationFinder.getCoveringClassDeclaration().getBody(), Block.STATEMENTS_PROPERTY);
    VariableBase dispatcher = ast.newVariable(THIS_VARIABLE_NAME);
View Full Code Here


     
      previewProgram.recordModifications();
      AST previewAST = previewProgram.getAST();
     
      FunctionDeclaration function = previewAST.newFunctionDeclaration(previewAST.newIdentifier(fMethodName), computeArguments(previewAST), previewAST.newBlock(), false);
      MethodDeclaration method = previewAST.newMethodDeclaration(fModifierAccessFlag, function);
      previewProgram.statements().add(method);
     
      Document myDoc = new Document();
      previewProgram.rewrite(myDoc, null).apply(myDoc);
     
View Full Code Here

    String str = "<?php class MyClass { function foo(){ return new MyClass(); } } ?>";
    Program program = createAndParse(str);

    ClassDeclaration classDeclaration = (ClassDeclaration) program
        .statements().get(0);
    MethodDeclaration methodDeclaration = (MethodDeclaration) classDeclaration
        .getBody().statements().get(0);

    IMethodBinding methodBinding = methodDeclaration.resolveMethodBinding();
    Assert.assertNotNull(methodBinding);
    Assert.assertTrue(methodBinding.getName().equals("foo"));
    Assert.assertNotNull(methodBinding.getDeclaringClass());
    Assert.assertTrue(methodBinding.getDeclaringClass().getName()
        .equals("MyClass"));
View Full Code Here

    String str = "<?php class MyClass { function foo(){ yield 1; } } ?>";
    Program program = createAndParse(str);

    ClassDeclaration classDeclaration = (ClassDeclaration) program
        .statements().get(0);
    MethodDeclaration methodDeclaration = (MethodDeclaration) classDeclaration
        .getBody().statements().get(0);

    IMethodBinding methodBinding = methodDeclaration.resolveMethodBinding();
    Assert.assertNotNull(methodBinding);
    Assert.assertTrue(methodBinding.getName().equals("foo"));
    Assert.assertNotNull(methodBinding.getDeclaringClass());
    Assert.assertTrue(methodBinding.getDeclaringClass().getName()
        .equals("MyClass"));
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.ast.nodes.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.