aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2012-08-08 01:05:20 (EDT)
committerzzhongwei2012-08-08 01:05:20 (EDT)
commit36bf08e33b1454a11daad7abc123a95034569d7a (patch)
treedab2eec2ebef4bb6f707407be1ca8c6935d71025
parente7dacc17459fe432527d3c3711a83d2bb49d892a (diff)
downloadorg.eclipse.pdt-36bf08e33b1454a11daad7abc123a95034569d7a.zip
org.eclipse.pdt-36bf08e33b1454a11daad7abc123a95034569d7a.tar.gz
org.eclipse.pdt-36bf08e33b1454a11daad7abc123a95034569d7a.tar.bz2
386798: CA for callable keyword
https://bugs.eclipse.org/bugs/show_bug.cgi?id=386798
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/FunctionParameterKeywordTypeStrategy.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/FunctionParameterKeywordTypeStrategy.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/FunctionParameterKeywordTypeStrategy.java
index ad9410a..480c45f 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/FunctionParameterKeywordTypeStrategy.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/FunctionParameterKeywordTypeStrategy.java
@@ -18,6 +18,7 @@ import org.eclipse.php.core.codeassist.ICompletionContext;
import org.eclipse.php.core.codeassist.IElementFilter;
import org.eclipse.php.core.compiler.PHPFlags;
import org.eclipse.php.internal.core.PHPCorePlugin;
+import org.eclipse.php.internal.core.PHPVersion;
import org.eclipse.php.internal.core.codeassist.ICompletionReporter;
import org.eclipse.php.internal.core.codeassist.contexts.FunctionParameterTypeContext;
import org.eclipse.php.internal.core.language.keywords.PHPKeywords.KeywordData;
@@ -31,6 +32,7 @@ import org.eclipse.php.internal.core.language.keywords.PHPKeywords.KeywordData;
*/
public class FunctionParameterKeywordTypeStrategy extends KeywordsStrategy {
+ private static final String CALLABLE = "callable";
public static final String[] KEYWORDS = { "self", "parent" };
/**
@@ -52,13 +54,13 @@ public class FunctionParameterKeywordTypeStrategy extends KeywordsStrategy {
public void apply(ICompletionReporter reporter) throws BadLocationException {
FunctionParameterTypeContext context = (FunctionParameterTypeContext) getContext();
+ String prefix = context.getPrefix();
+ String suffix = "";
+ SourceRange replaceRange = getReplacementRange(context);
if (context.getEnclosingType() != null) {
try {
int flags = context.getEnclosingType().getFlags();
if (!PHPFlags.isNamespace(flags)) {
- SourceRange replaceRange = getReplacementRange(context);
- String suffix = "";
- String prefix = context.getPrefix();
for (String keyword : KEYWORDS) {
if (keyword.startsWith(prefix)) {
reporter.reportKeyword(keyword, suffix,
@@ -71,6 +73,12 @@ public class FunctionParameterKeywordTypeStrategy extends KeywordsStrategy {
}
}
+ PHPVersion phpVersion = context.getPhpVersion();
+ if (phpVersion.isGreaterThan(PHPVersion.PHP5_3)) {
+ if (CALLABLE.startsWith(prefix)) {
+ reporter.reportKeyword(CALLABLE, suffix, replaceRange);
+ }
+ }
}
/*