Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/ast/locator/PhpElementConciliator.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/ast/locator/PhpElementConciliator.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/ast/locator/PhpElementConciliator.java
index d96e33e79..574ba0e9a 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/ast/locator/PhpElementConciliator.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/ast/locator/PhpElementConciliator.java
@@ -134,11 +134,20 @@ public class PhpElementConciliator {
Scalar scalar = null;
// check if it is an identifier
if (locateNode.getType() != ASTNode.SCALAR) {
+ ASTNode parent = locateNode.getParent();
+ ASTNode node = null;
+ // php 5.3, the parent is NamespaceName
+ if (parent instanceof NamespaceName) {
+ node = parent.getParent().getParent();
+ } else { // non-php 5.3
+ node = parent.getParent();
+ }
+
+ // check if the node is 'define'
if ((locateNode instanceof Identifier)
&& "define".equals(((Identifier) locateNode).getName())
- && locateNode.getParent().getParent() instanceof FunctionInvocation) {
- FunctionInvocation inv = (FunctionInvocation) locateNode
- .getParent().getParent();
+ && node instanceof FunctionInvocation) {
+ FunctionInvocation inv = (FunctionInvocation) node;
List<Expression> parameters = inv.parameters();
if (parameters != null && parameters.size() > 0) {
scalar = (Scalar) parameters.get(0);
@@ -457,7 +466,7 @@ public class PhpElementConciliator {
targetIdentifier = (Identifier) locateNode;
parent = targetIdentifier.getParent();
if (parent.getType() == ASTNode.NAMESPACE_NAME) {
- parent = targetIdentifier.getParent();
+ parent = targetIdentifier.getParent().getParent();
}
} else {
return false;

Back to the top