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

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


   
    ASTRewrite rewriter = ASTRewrite.create(ast);
   
    ListRewrite classListRewrite = rewriter.getListRewrite( fCoveringDeclarationFinder.getCoveringClassDeclaration().getBody(), Block.STATEMENTS_PROPERTY);
    VariableBase dispatcher = ast.newVariable(THIS_VARIABLE_NAME);
    FunctionInvocation calledExtractedMethod = ast.newFunctionInvocation(ast.newFunctionName(ast.newIdentifier(fMethodName)), computeParameters(ast));
    MethodInvocation inlineMethodCall = ast.newMethodInvocation(dispatcher, calledExtractedMethod);

    List<List<ASTNode>> Occurences = new ArrayList<List<ASTNode>>();
   
    if(fReplaceDuplicates) {
View Full Code Here


      switch (node.getType()) {
      case ASTNode.METHOD_INVOCATION:
        MethodInvocation inv = (MethodInvocation) node;
        return getBasicName(inv.getMethod());
      case ASTNode.FUNCTION_INVOCATION:
        FunctionInvocation func = (FunctionInvocation) node;
        if (func.getFunctionName() == null || func.getFunctionName().getName() == null) {
          return DEFAULT_NAME;
        }
       
        return getBasicName(func.getFunctionName().getName());
      case ASTNode.STATIC_METHOD_INVOCATION:
        StaticMethodInvocation st = (StaticMethodInvocation) node;
        return getBasicName(st.getMethod());
      case ASTNode.CLASS_INSTANCE_CREATION:
        ClassInstanceCreation ci = (ClassInstanceCreation) node;
View Full Code Here

    initialize(str);

    List<FunctionInvocation> invocations = getAllOfType(program,
        FunctionInvocation.class);
    Assert.assertTrue("Unexpected list size.", invocations.size() == 1);
    FunctionInvocation functionInvocation = invocations.get(0);
    functionInvocation.setFunctionName(ast.newFunctionName(ast
        .newIdentifier("boobo")));
    rewrite();
    checkResult("<?php boobo(); ?>");
  }
View Full Code Here

    initialize(str);

    List<FunctionInvocation> invocations = getAllOfType(program,
        FunctionInvocation.class);
    Assert.assertTrue("Unexpected list size.", invocations.size() == 1);
    FunctionInvocation functionInvocation = invocations.get(0);
    functionInvocation.parameters().add(ast.newVariable("aaa"));
    rewrite();
    checkResult("<?php foo($aaa ); ?>");
  }
View Full Code Here

    initialize(str);

    List<FunctionInvocation> invocations = getAllOfType(program,
        FunctionInvocation.class);
    Assert.assertTrue("Unexpected list size.", invocations.size() == 1);
    FunctionInvocation functionInvocation = invocations.get(0);
    functionInvocation.parameters().add(ast.newVariable("aaa"));
    functionInvocation.parameters().add(ast.newVariable("bbb"));
    functionInvocation.parameters().add(ast.newVariable("ccc"));
    rewrite();
    checkResult("<?php foo($aaa, $bbb, $ccc); ?>");
  }
View Full Code Here

    initialize(str);

    List<FunctionInvocation> invocations = getAllOfType(program,
        FunctionInvocation.class);
    Assert.assertTrue("Unexpected list size.", invocations.size() == 1);
    FunctionInvocation functionInvocation = invocations.get(0);
    functionInvocation.parameters().remove(1);
    rewrite();
    checkResult("<?php foo($aaa); ?>");
  }
View Full Code Here

    initialize(str);

    List<FunctionInvocation> invocations = getAllOfType(program,
        FunctionInvocation.class);
    Assert.assertTrue("Unexpected list size.", invocations.size() == 1);
    FunctionInvocation functionInvocation = invocations.get(0);
    functionInvocation.parameters().remove(0);
    rewrite();
    checkResult("<?php foo($bbb); ?>");
  }
View Full Code Here

    initialize(str);

    List<FunctionInvocation> invocations = getAllOfType(program,
        FunctionInvocation.class);
    Assert.assertTrue("Unexpected list size.", invocations.size() == 1);
    FunctionInvocation functionInvocation = invocations.get(0);
    functionInvocation.parameters().clear();
    rewrite();
    checkResult("<?php foo(); ?>");
  }
View Full Code Here

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

    ExpressionStatement statement = (ExpressionStatement) program
        .statements().get(1);
    FunctionInvocation functionInvocation = (FunctionInvocation) statement
        .getExpression();

    IFunctionBinding functionBinding = functionInvocation
        .resolveFunctionBinding();
    Assert.assertNotNull(functionBinding);
    Assert.assertTrue(functionBinding.getName().equals("foo"));
    Assert.assertTrue(functionBinding.isVarargs() == false);
  }
View Full Code Here

    String expected = "<?php $foo('s<>&', 12, true, __CLASS__); ?>";
    parseAndCompare(str, expected, new ICodeManiplator() {
      public void manipulate(Program program) {
        ExpressionStatement statement = (ExpressionStatement) program
            .statements().get(0);
        FunctionInvocation functionInvocation = (FunctionInvocation) statement
            .getExpression();
        functionInvocation.parameters().remove(0);
      }
    });
  }
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.ast.nodes.FunctionInvocation

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.