aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2013-03-20 01:33:35 (EDT)
committerzzhongwei2013-03-20 01:33:35 (EDT)
commitec458f4e71f82c1a0879bb4d22c5e36737c533f6 (patch)
tree7983f7cc720b4c70b789f1a974c1efe45c4acc10
parentf356ca0fa2f75f969bbab80bf0f4ef210f36479f (diff)
downloadorg.eclipse.pdt-ec458f4e71f82c1a0879bb4d22c5e36737c533f6.zip
org.eclipse.pdt-ec458f4e71f82c1a0879bb4d22c5e36737c533f6.tar.gz
org.eclipse.pdt-ec458f4e71f82c1a0879bb4d22c5e36737c533f6.tar.bz2
403858: multiple class hinting for param tag in phpdoc
https://bugs.eclipse.org/bugs/show_bug.cgi?id=403858
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/FormalParameterEvaluator.java40
1 files changed, 32 insertions, 8 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/FormalParameterEvaluator.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/FormalParameterEvaluator.java
index 8937d3c..087bf91 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/FormalParameterEvaluator.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/typeinference/evaluators/FormalParameterEvaluator.java
@@ -15,6 +15,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.dltk.ast.references.SimpleReference;
import org.eclipse.dltk.core.IMethod;
import org.eclipse.dltk.core.IModelElement;
+import org.eclipse.dltk.evaluation.types.MultiTypeType;
import org.eclipse.dltk.ti.GoalState;
import org.eclipse.dltk.ti.IContext;
import org.eclipse.dltk.ti.goals.ExpressionTypeGoal;
@@ -92,15 +93,38 @@ public class FormalParameterEvaluator extends GoalEvaluator {
.getName();
if (typeName
.endsWith(PHPDocClassVariableEvaluator.BRACKETS)) {
- typeName = typeName.substring(0, typeName.length() -2);
+ typeName = typeName.substring(0,
+ typeName.length() - 2);
}
- result = PHPClassType
- .fromTypeName(
- typeName,
- methodContext
- .getSourceModule(),
- references[1]
- .sourceStart());
+ if (typeName.indexOf('|') >= 0) {
+ String[] typeNames = typeName
+ .split("|");
+ MultiTypeType arrayType = new MultiTypeType();
+ for (int i = 0; i < typeNames.length; i++) {
+ if (typeNames[i].trim()
+ .length() == 0
+ || typeNames[i]
+ .equals("|")) {
+ continue;
+ }
+ arrayType
+ .addType(PHPClassType
+ .fromTypeName(
+ typeNames[i],
+ methodContext
+ .getSourceModule(),
+ references[1]
+ .sourceStart()));
+ }
+ result = arrayType;
+ } else
+ result = PHPClassType
+ .fromTypeName(
+ typeName,
+ methodContext
+ .getSourceModule(),
+ references[1]
+ .sourceStart());
}
}
}