aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2012-09-24 01:34:26 (EDT)
committerzzhongwei2012-09-24 01:34:26 (EDT)
commitf52a999ccf819cebe716e5259cef862a8c757c13 (patch)
tree1ddd0eac794950a60d7c77e00c890129abbdab89
parent824a8deda7a5dc3d267f04bdd13ea14e0e92be8e (diff)
downloadorg.eclipse.pdt-f52a999ccf819cebe716e5259cef862a8c757c13.zip
org.eclipse.pdt-f52a999ccf819cebe716e5259cef862a8c757c13.tar.gz
org.eclipse.pdt-f52a999ccf819cebe716e5259cef862a8c757c13.tar.bz2
390165: CA does not work when using a super class
https://bugs.eclipse.org/bugs/show_bug.cgi?id=390165
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/compiler/PHPSourceElementRequestor.java11
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/index/PhpIndexingVisitor.java13
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testClassMembers12-nonstrict.pdtt23
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testClassMembers12-strict.pdtt23
4 files changed, 69 insertions, 1 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/compiler/PHPSourceElementRequestor.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/compiler/PHPSourceElementRequestor.java
index f23c89f..43a1e98 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/compiler/PHPSourceElementRequestor.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/compiler/PHPSourceElementRequestor.java
@@ -430,11 +430,22 @@ public class PHPSourceElementRequestor extends SourceElementRequestVisitor {
if (fullyQualifiedName.getNamespace() != null) {
String namespace = fullyQualifiedName.getNamespace()
.getName();
+
+ String subnamespace = "";
+ if (namespace.charAt(0) != NamespaceReference.NAMESPACE_SEPARATOR
+ && namespace
+ .indexOf(NamespaceReference.NAMESPACE_SEPARATOR) > 0) {
+ int firstNSLocation = namespace
+ .indexOf(NamespaceReference.NAMESPACE_SEPARATOR);
+ subnamespace = namespace.substring(firstNSLocation);
+ namespace = namespace.substring(0, firstNSLocation);
+ }
if (name.charAt(0) == NamespaceReference.NAMESPACE_SEPARATOR) {
name = name.substring(1);
} else if (fLastUseParts.containsKey(namespace)) {
name = new StringBuilder(fLastUseParts.get(namespace)
.getNamespace().getFullyQualifiedName())
+ .append(subnamespace)
.append(NamespaceReference.NAMESPACE_SEPARATOR)
.append(fullyQualifiedName.getName())
.toString();
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/index/PhpIndexingVisitor.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/index/PhpIndexingVisitor.java
index 8476e60..ed8f816 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/index/PhpIndexingVisitor.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/index/PhpIndexingVisitor.java
@@ -390,11 +390,21 @@ public class PhpIndexingVisitor extends PhpIndexingVisitorExtension {
if (fullyQualifiedName.getNamespace() != null) {
String namespace = fullyQualifiedName.getNamespace()
.getName();
+ String subnamespace = "";
+ if (namespace.charAt(0) != NamespaceReference.NAMESPACE_SEPARATOR
+ && namespace
+ .indexOf(NamespaceReference.NAMESPACE_SEPARATOR) > 0) {
+ int firstNSLocation = namespace
+ .indexOf(NamespaceReference.NAMESPACE_SEPARATOR);
+ subnamespace = namespace.substring(firstNSLocation);
+ namespace = namespace.substring(0, firstNSLocation);
+ }
if (name.charAt(0) == NamespaceReference.NAMESPACE_SEPARATOR) {
name = name.substring(1);
} else if (fLastUseParts.containsKey(namespace)) {
name = new StringBuilder(fLastUseParts.get(namespace)
.getNamespace().getFullyQualifiedName())
+ .append(subnamespace)
.append(NamespaceReference.NAMESPACE_SEPARATOR)
.append(fullyQualifiedName.getName())
.toString();
@@ -811,7 +821,8 @@ public class PhpIndexingVisitor extends PhpIndexingVisitorExtension {
public boolean visit(FieldAccess access) throws Exception {
// This is variable field access:
if (access.getField() instanceof SimpleReference) {
- SimpleReference simpleReference = (SimpleReference) access.getField();
+ SimpleReference simpleReference = (SimpleReference) access
+ .getField();
String name = simpleReference.getName();
if (!name.startsWith(DOLOR)) {
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testClassMembers12-nonstrict.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testClassMembers12-nonstrict.pdtt
new file mode 100644
index 0000000..aca377b
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testClassMembers12-nonstrict.pdtt
@@ -0,0 +1,23 @@
+--TEST--
+Should complete class variables using PHPDoc @var hinting
+--PREFERENCES--
+org.eclipse.php.core/contentAssistShowStrictOptions=false
+--FILE--
+<?php
+namespace zend\test1;
+class Test1 {
+ function foo() {
+ ;
+ }
+}
+
+namespace zend1\test2;
+use zend as ze;
+class Test2 extends ze\test1\Test1 {
+}
+$a = new Test2();
+
+$a->|
+?>
+--EXPECT--
+method(foo) \ No newline at end of file
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testClassMembers12-strict.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testClassMembers12-strict.pdtt
new file mode 100644
index 0000000..370645c
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testClassMembers12-strict.pdtt
@@ -0,0 +1,23 @@
+--TEST--
+Should complete class variables using PHPDoc @var hinting
+--PREFERENCES--
+org.eclipse.php.core/contentAssistShowStrictOptions=true
+--FILE--
+<?
+namespace zend\test1;
+class Test1 {
+ function foo() {
+ ;
+ }
+}
+
+namespace zend1\test2;
+use zend as ze;
+class Test2 extends ze\test1\Test1 {
+}
+$a = new Test2();
+
+$a->|
+?>
+--EXPECT--
+method(foo) \ No newline at end of file