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

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


    if (!isMethodParameter(variable)) {
     
      ParameterInfo newParameter = new ParameterInfo(
          ((Identifier) variable.getName()).getName());
     
      ITypeBinding binding = variable.resolveTypeBinding();

      if (binding != null) {
        if (binding.isArray()) {
          newParameter.setParameterType(TYPE_HINT_ARRAY);
        } else if (binding.isClass()) {
          newParameter.setParameterType(binding.getName());
        }
      }
     
      fExtractedMethodParameters.add(newParameter);
    }
View Full Code Here


    // 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

  }

  public void testBasicExpression() throws Exception {
    // create a file and get the program's root
    String content = "<? class A { function foo() { $a = 4; $b =  /**/$a; } } ?>";
    ITypeBinding type = getTypeBinding(content);

    // check that it is a number
    Assert.assertEquals(type.getName(), "number");
  }
View Full Code Here

  }

  public void testBasicType() throws Exception {
    // create a file and get the program's root
    String content = "<? class A {  } ; class B extends /**/A { } ?>";
    ITypeBinding type = getTypeBinding(content);

    // check that it is a number
    Assert.assertEquals(type.getName(), "A");
  }
View Full Code Here

  }

  public void testIsArray() throws Exception {
    // create a file and get the program's root
    String content = "<? interface B {} class A implements B { function foo() { $a = array(1, 2, 3); $b = /**/$a; } } ?>";
    ITypeBinding type = getTypeBinding(content);
    Assert.assertTrue(type.isArray());
  }
View Full Code Here

  }

  public void testIsClass() throws Exception {
    // create a file and get the program's root
    String content = "<? interface B {} class A implements B { function foo() { $a = new A(); $b = /**/$a; } } ?>";
    ITypeBinding type = getTypeBinding(content);
    Assert.assertTrue(type.isClass());
  }
View Full Code Here

  }

  public void testIsInterface() throws Exception {
    // create a file and get the program's root
    String content = "<? interface B {} class A implements /**/B { function foo() { $a = new A(); $b = $a; } } ?>";
    ITypeBinding type = getTypeBinding(content);
    Assert.assertTrue(type.isInterface());
  }
View Full Code Here

  }

  public void testIsNullType() throws Exception {
    // create a file and get the program's root
    String content = "<? interface B {} class A implements B { function foo() { $a = null; $b = /**/$a; } } ?>";
    ITypeBinding type = getTypeBinding(content);
    Assert.assertTrue(type.isNullType());
  }
View Full Code Here

  }

  public void testIsPrimitive() throws Exception {
    // create a file and get the program's root
    String content = "<? interface B {} class A implements B { function foo() { $a = true; $b = /**/$a; } } ?>";
    ITypeBinding type = getTypeBinding(content);
    Assert.assertTrue(type.isPrimitive());
  }
View Full Code Here

  public void testIsSubTypeCompatibleTrue() throws Exception {
    // create a file and get the program's root
    String content = "<? interface B {} class A implements /**/B { function foo() { $a = true; $b = $a; } } class C extends A{} /**/$c = new C()?>";
    int indexOf = locateElement(content, 0);
    ITypeBinding type = getTypeBinding(content);
    ITypeBinding otherType = getTypeBinding(content, indexOf + 4);
    Assert.assertTrue("Should be sub-type compatible",
        otherType.isSubTypeCompatible(type));
  }
View Full Code Here

TOP

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

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.