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

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


      fail(e.getMessage());
    }

    assertNotNull(file);

    Program program = createProgram(file);

    assertNotNull(program);

    // select the function declaration.
    int start = 25;
View Full Code Here


      fail(e.getMessage());
    }

    assertNotNull(file);

    Program program = createProgram(file);

    assertNotNull(program);

    // select the function declaration.
    int start = 26;
View Full Code Here

   * @throws CoreException
   * @throws Exception
   */
  protected ITypeBinding getTypeBinding(String content, int fromIndex)
      throws CoreException, Exception {
    Program program = createAndParse(content);

    // locate the expression to test
    int indexOf = locateElement(content, fromIndex);
    Expression expr = (Expression) program.getElementAt(indexOf);

    // resolve binding of the expression
    ITypeBinding type = expr.resolveTypeBinding();
    return type;
  }
View Full Code Here

      fail(e.getMessage());
    }

    assertNotNull(file);

    Program program = createProgram(file);

    assertNotNull(program);

    // select the function declaration.
    int start = 27;
View Full Code Here

  // Assert.assertNotNull(resolveConstantExpressionValue);
  // }

  public void testConstructorBinding() throws Exception {
    String str = "<?php $a = new MyClass(); class MyClass { public function MyClass() {} } ?>";
    Program program = createAndParse(str);

    ExpressionStatement statement = (ExpressionStatement) program
        .statements().get(0);
    Assignment assignment = (Assignment) statement.getExpression();
    ClassInstanceCreation instanceCreation = (ClassInstanceCreation) assignment
        .getRightHandSide();
View Full Code Here

      fail(e.getMessage());
    }

    assertNotNull(file);

    Program program = createProgram(file);

    assertNotNull(program);

    // select the function declaration.
    int start = 20;
View Full Code Here

    Assert.assertTrue(constructorBinding.getKind() == IBinding.METHOD);
  }

  public void testExpressionBinding() throws Exception {
    String str = "<?php $a = 5+5 ?>";
    Program program = createAndParse(str);

    ExpressionStatement statement = (ExpressionStatement) program
        .statements().get(0);
    Assignment assignment = (Assignment) statement.getExpression();
    InfixExpression infixExpression = (InfixExpression) assignment
        .getRightHandSide();
View Full Code Here

    // TODO
  }

  public void testFieldAccessBinding() throws Exception {
    String str = "<?php class MyClass { var $anotherOne; }; $a = new MyClass(); $b = $a->anotherOne ?>";
    Program program = createAndParse(str);

    ExpressionStatement statement = (ExpressionStatement) program
        .statements().get(3);
    Assignment assignment = (Assignment) statement.getExpression();
    FieldAccess fieldAccess = (FieldAccess) assignment.getRightHandSide();

    IVariableBinding variableBinding = fieldAccess.resolveFieldBinding();
View Full Code Here

    Assert.assertTrue(variableBinding.getKind() == IBinding.VARIABLE);
  }

  public void testThisFieldAccessBinding() throws Exception {
    String str = "<?php class MyClass { public $myvar = \"test\"; public function mymethod(){ return $this->myvar; }} $a = new MyClass(); $a->mymethod();?>";
    Program program = createAndParse(str);

    ExpressionStatement statement = (ExpressionStatement) program
        .statements().get(2);
    MethodInvocation methodInvocation = (MethodInvocation) statement
        .getExpression();
    IMethodBinding methodBinding = methodInvocation.resolveMethodBinding();
View Full Code Here

        "string"));
  }

  public void testStaticFieldAccessBinding() throws Exception {
    String str = "<?php class MyClass { public static $a = 4; } ; /**/MyClass::$a;?>";
    Program program = createAndParse(str);

    final ExpressionStatement statement = (ExpressionStatement) program
        .statements().get(2);
    final StaticFieldAccess staticFieldAcces = (StaticFieldAccess) statement
        .getExpression();
    IVariableBinding fieldBinding = staticFieldAcces.resolveFieldBinding();

View Full Code Here

TOP

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

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.