Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDawid Pakuła2019-07-10 05:29:11 -0400
committerDawid Pakula2019-07-12 10:33:06 -0400
commit591c8459b305c7d9d97011ae8bdd87aace9ef8ba (patch)
tree5c4a74b936be45ffacdb4d5c73b4ea423b4597b3
parent9965c53eb0a42ddf6766f4f38745673c3e3147a5 (diff)
downloadorg.eclipse.pdt-591c8459b305c7d9d97011ae8bdd87aace9ef8ba.tar.gz
org.eclipse.pdt-591c8459b305c7d9d97011ae8bdd87aace9ef8ba.tar.xz
org.eclipse.pdt-591c8459b305c7d9d97011ae8bdd87aace9ef8ba.zip
Bug 549068 - No property / method proposal for Cloned object
Fix regression after bug 536998 Change-Id: If0e2db58d32fcd1fba6209255d740fbb8c91ec16 Signed-off-by: Dawid Pakuła <zulus@w3des.net>
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/VariableDeclarationSearcher.java2
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/VariableReferenceEvaluator.java14
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549068.pdtt17
3 files changed, 25 insertions, 8 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/VariableDeclarationSearcher.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/VariableDeclarationSearcher.java
index 895596017..a7b6ec571 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/VariableDeclarationSearcher.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/VariableDeclarationSearcher.java
@@ -172,7 +172,7 @@ public class VariableDeclarationSearcher extends ContextFinder {
return super.visit(node);
}
- private void addDeclaredVariables(Expression variable, Expression node) {
+ protected void addDeclaredVariables(Expression variable, Expression node) {
if (variable instanceof VariableReference) {
VariableReference varReference = (VariableReference) variable;
getScope().addDeclaration(varReference.getName(), node);
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/VariableReferenceEvaluator.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/VariableReferenceEvaluator.java
index 8541359cc..f60129675 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/VariableReferenceEvaluator.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/VariableReferenceEvaluator.java
@@ -275,15 +275,15 @@ public class VariableReferenceEvaluator extends GoalEvaluator {
@Override
protected boolean isInteresting(ASTNode node) {
+ return node.sourceStart() <= variableOffset;
+ }
- if (node.sourceStart() <= variableOffset) {
- if (node instanceof Assignment && ((Assignment) node).getValue() instanceof CloneExpression) {
- return false;
- }
- return true;
+ @Override
+ protected void addDeclaredVariables(Expression variable, Expression node) {
+ if (node.start() < variableOffset && node.end() > variableOffset) {
+ return;
}
-
- return false;
+ super.addDeclaredVariables(variable, node);
}
}
}
diff --git a/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549068.pdtt b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549068.pdtt
new file mode 100644
index 000000000..7561f8149
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/codeassist/php53/test549068.pdtt
@@ -0,0 +1,17 @@
+--TEST--
+Bug http://eclip.se/549068
+--PREFERENCES--
+org.eclipse.php.core/contentAssistShowStrictOptions=false
+--FILE--
+<?php
+namespace Foo {
+ class Bar {
+ public function func() {
+ $v = clone $this;
+ $v->|
+ }
+ }
+}
+
+--EXPECT--
+method(func) \ No newline at end of file

Back to the top