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

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


  public void testIsSubTypeCompatibleFalse() 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.assertFalse("Should NOT be sub-type compatible",
        type.isSubTypeCompatible(otherType));
  }
View Full Code Here


  }

  public void testBinaryName() 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);
    String binaryName = type.getBinaryName();
    Assert.assertNotNull("Binary name was null", binaryName);
  }
View Full Code Here

  // }

  public void testGetDeclaredFields() throws Exception {
    // create a file and get the program's root
    String content = "<? interface B {} class A implements B { public $value; private $pValue; function foo() { $a = new A(); $b = /**/$a; } } ?>";
    ITypeBinding type = getTypeBinding(content);
    IVariableBinding[] declaredFields = type.getDeclaredFields();
    declaredFields[0].getDeclaringClass();
    // declaredFields[0].getDeclaringFunction();
    // TODO - complete the implementation of VariableBinding
  }
View Full Code Here

  }

  public void testGetDeclaredMethods() throws Exception {
    // create a file and get the program's root
    String content = "<? interface B {} class A implements B { public $value; private $pValue; function foo() { $a = new A(); $b = /**/$a; } } ?>";
    ITypeBinding type = getTypeBinding(content);
    IMethodBinding[] declaredMethods = type.getDeclaredMethods();
    Assert.assertTrue("The declaring type name is wrong",
        declaredMethods[0].getDeclaringClass().getName().equals("A"));
    // declaredFields[0].getDeclaringFunction();
    // TODO - complete the implementation of MethodBinding
  }
View Full Code Here

  public void testOverrides() throws Exception {
    // create a file and get the program's root
    String content = "<? interface B { function foo(); } class A implements /**/B { public $value; private $pValue; function foo() { $a = new A(); $b = /**/$a; } function boo() {} function foo($g) {} } ?>";
    int index = locateElement(content);
    ITypeBinding type = getTypeBinding(content);
    IMethodBinding[] interfaceBMethods = type.getDeclaredMethods();

    type = getTypeBinding(content, index + 4);
    IMethodBinding[] classAMethods = type.getDeclaredMethods();
    Assert.assertTrue("Should override",
        classAMethods[0].overrides(interfaceBMethods[0]));
    Assert.assertFalse("Should NOT override",
        classAMethods[1].overrides(interfaceBMethods[0]));
    Assert.assertTrue("Should override",
View Full Code Here

        .statements().get(0);
    Assignment assignment = (Assignment) statement.getExpression();
    InfixExpression infixExpression = (InfixExpression) assignment
        .getRightHandSide();

    ITypeBinding expressionBinding = infixExpression.resolveTypeBinding();

    Assert.assertTrue(expressionBinding.getKind() == IBinding.TYPE);
    // TODO
  }
View Full Code Here

    IMethodBinding methodBinding = methodInvocation.resolveMethodBinding();
    Assert.assertNotNull(methodBinding);
    Assert.assertTrue(methodBinding.getName().equals("foo"));

    ITypeBinding declaringClass = methodBinding.getDeclaringClass();
    Assert.assertNotNull(declaringClass);
    Assert.assertTrue(declaringClass.getName().equals("MyClass"));

    Assert.assertTrue(methodBinding.isConstructor() == false);
  }
View Full Code Here

    Assert.assertNotNull(methodBinding);
    Assert.assertTrue(methodBinding.isConstructor() == false);
    Assert.assertTrue(methodBinding.getName().equals("foo"));

    ITypeBinding declaringClass = methodBinding.getDeclaringClass();
    Assert.assertNotNull(declaringClass);
    Assert.assertTrue(declaringClass.getName().equals("MyClass"));
    Assert.assertTrue(methodBinding.getKind() == IBinding.METHOD);
  }
View Full Code Here

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

    ClassDeclaration classDeclaration = (ClassDeclaration) program
        .statements().get(0);
    ITypeBinding binding = classDeclaration.resolveTypeBinding();

    Assert.assertNotNull(binding);
    Assert.assertTrue(binding.getName().equals("A"));
    Assert.assertTrue(binding.getKind() == IBinding.TYPE);
    Assert.assertTrue(binding.isClass());
  }
View Full Code Here

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

    InterfaceDeclaration interfaceDeclaration = (InterfaceDeclaration) program
        .statements().get(0);
    ITypeBinding binding = interfaceDeclaration.resolveTypeBinding();

    Assert.assertNotNull(binding);
    Assert.assertTrue(binding.getName().equals("A"));
    Assert.assertTrue(binding.getKind() == IBinding.TYPE);
    Assert.assertTrue(binding.isInterface());
  }
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.