aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDawid Pakuła2013-10-27 14:04:55 (EDT)
committerDawid Pakuła2013-10-27 14:04:55 (EDT)
commitf6c29bce2aed75eeb0f978bdbea1bca287f92e7e (patch)
tree920f1d78440e76301e7eb42242e621fc52773919
parent75934c174061f7901335425ebc13778ade23ce82 (diff)
downloadorg.eclipse.pdt-f6c29bce2aed75eeb0f978bdbea1bca287f92e7e.zip
org.eclipse.pdt-f6c29bce2aed75eeb0f978bdbea1bca287f92e7e.tar.gz
org.eclipse.pdt-f6c29bce2aed75eeb0f978bdbea1bca287f92e7e.tar.bz2
Read offset from contextrefs/changes/07/17807/1
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=419539 Change-Id: Ie16fa42f7fb7fc29a3bbab4587cad1d12758a04c Signed-off-by: Dawid Pakuła <zulus@w3des.net>
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/goals/AbstractMethodReturnTypeGoal.java10
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testVariable2.pdtt19
2 files changed, 27 insertions, 2 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/goals/AbstractMethodReturnTypeGoal.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/goals/AbstractMethodReturnTypeGoal.java
index dfb6af3..3b2b98c 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/goals/AbstractMethodReturnTypeGoal.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/goals/AbstractMethodReturnTypeGoal.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Zend Technologies
@@ -20,6 +20,7 @@ import org.eclipse.dltk.ti.ISourceModuleContext;
import org.eclipse.dltk.ti.goals.AbstractTypeGoal;
import org.eclipse.dltk.ti.types.IEvaluatedType;
import org.eclipse.php.internal.core.typeinference.PHPTypeInferenceUtils;
+import org.eclipse.php.internal.core.typeinference.context.MethodContext;
public abstract class AbstractMethodReturnTypeGoal extends AbstractTypeGoal {
@@ -61,8 +62,13 @@ public abstract class AbstractMethodReturnTypeGoal extends AbstractTypeGoal {
public IType[] getTypes() {
if (types == null) {
if (evaluatedType != null) {
+ final ISourceModuleContext cnt = (ISourceModuleContext) context;
+
types = PHPTypeInferenceUtils.getModelElements(evaluatedType,
- (ISourceModuleContext) context);
+ cnt,
+ cnt instanceof MethodContext ? ((MethodContext) cnt)
+ .getMethodNode().start() : cnt.getRootNode()
+ .end());
}
}
return types;
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testVariable2.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testVariable2.pdtt
new file mode 100644
index 0000000..a415057
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/testVariable2.pdtt
@@ -0,0 +1,19 @@
+--TEST--
+Should complete item() method in namespaced method after return assign
+--FILE--
+<?
+namespace NS;
+class A {
+ function item() {
+ return new A();
+ }
+}
+
+function test_arg(A $t) {
+ $x = $t->item();
+ $x->|
+} }
+}
+?>
+--EXPECT--
+method(item)