Examples of FunctionDeclaration


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

  public void testDeleteFunctionFormalFirst() throws Exception {
    String str = "<?php function foo($a, $b, $c = 5) { $a= 5; $b = 6; $c = 7; } ?>";
    String expected = "<?php function foo($b, $c = 5) { $a= 5; $b = 6; $c = 7; } ?>";
    parseAndCompare(str, expected, new ICodeManiplator() {
      public void manipulate(Program program) {
        FunctionDeclaration statement = (FunctionDeclaration) program
            .statements().get(0);
        statement.formalParameters().remove(0);
      }
    });
  }
View Full Code Here

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

  public void testDeleteFunctionFormalLast() throws Exception {
    String str = "<?php function foo($a, $b, $c = 5) { $a= 5; $b = 6; $c = 7; } ?>";
    String expected = "<?php function foo($a, $b) { $a= 5; $b = 6; $c = 7; } ?>";
    parseAndCompare(str, expected, new ICodeManiplator() {
      public void manipulate(Program program) {
        FunctionDeclaration statement = (FunctionDeclaration) program
            .statements().get(0);
        statement.formalParameters().remove(2);
      }
    });
  }
View Full Code Here

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

  public void testDeleteFunctionFormalMiddle() throws Exception {
    String str = "<?php function foo($a, $b, $c = 5) { $a= 5; $b = 6; $c = 7; } ?>";
    String expected = "<?php function foo($a, $c = 5) { $a= 5; $b = 6; $c = 7; } ?>";
    parseAndCompare(str, expected, new ICodeManiplator() {
      public void manipulate(Program program) {
        FunctionDeclaration statement = (FunctionDeclaration) program
            .statements().get(0);
        statement.formalParameters().remove(1);
      }
    });
  }
View Full Code Here

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

  public void testDeleteFunctionBodyFirst() throws Exception {
    String str = "<?php function foo() { $a= 5; $b = 6; $c = 7; } ?>";
    String expected = "<?php function foo() { $b = 6; $c = 7; } ?>";
    parseAndCompare(str, expected, new ICodeManiplator() {
      public void manipulate(Program program) {
        FunctionDeclaration statement = (FunctionDeclaration) program
            .statements().get(0);
        statement.getBody().statements().remove(0);
      }
    });
  }
View Full Code Here

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

  public void testDeleteFunctionBodyLast() throws Exception {
    String str = "<?php function foo() { $a= 5; $b = 6; $c = 7; } ?>";
    String expected = "<?php function foo() { $a= 5; $b = 6; } ?>";
    parseAndCompare(str, expected, new ICodeManiplator() {
      public void manipulate(Program program) {
        FunctionDeclaration statement = (FunctionDeclaration) program
            .statements().get(0);
        statement.getBody().statements().remove(2);
      }
    });
  }
View Full Code Here

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

  public void testDeleteFunctionBodyMiddle() throws Exception {
    String str = "<?php function foo() { $a= 5; $b = 6; $c = 7; } ?>";
    String expected = "<?php function foo() { $a= 5; $c = 7; } ?>";
    parseAndCompare(str, expected, new ICodeManiplator() {
      public void manipulate(Program program) {
        FunctionDeclaration statement = (FunctionDeclaration) program
            .statements().get(0);
        statement.getBody().statements().remove(1);
      }
    });
  }
View Full Code Here

Examples of org.netbeans.modules.php.editor.parser.astnodes.FunctionDeclaration

            super.visit(node);
            String methodName = CodeUtils.extractMethodName(node);
            if (!methodName.equals(targetMethodName)) {
                return;
            }
            FunctionDeclaration function = node.getFunction();
            List<FormalParameter> formalParameters = function.getFormalParameters();
            params.addAll(formalParameters);
        }
View Full Code Here

Examples of org.rascalmpl.ast.FunctionDeclaration

  }
 
  @Override
  public Type getFormals() {
    // get formals is overridden because we can provide labeled parameters for JavaMethods (no pattern matching)
    FunctionDeclaration func = (FunctionDeclaration) getAst();
   
    List<Expression> formals = func.getSignature().getParameters().getFormals().getFormals();
    int arity = formals.size();
    Type[] types = new Type[arity];
    String[] labels = new String[arity];
    FunctionType ft = getFunctionType();
   
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.