Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Locati2019-02-19 03:28:59 -0500
committerThierry BLIND2019-03-13 09:26:22 -0400
commit8a5516d597b25de9d94e05a6b765edf8fdc81802 (patch)
treea7de7a9b7efd7dba764be9fd9277fd721ef7418d
parent1f0b19d56f63dfd1c8e025d945008581e38fb0d9 (diff)
downloadorg.eclipse.pdt-8a5516d597b25de9d94e05a6b765edf8fdc81802.tar.gz
org.eclipse.pdt-8a5516d597b25de9d94e05a6b765edf8fdc81802.tar.xz
org.eclipse.pdt-8a5516d597b25de9d94e05a6b765edf8fdc81802.zip
Bug 544559 - Arrays defined in comments are not seen as defined
Change-Id: Ib542a88a301cb8f88e97ea2b98edfa0012db629a Signed-off-by: Michele Locati <michele@locati.it>
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/compiler/ast/validator/VariableValidator.java9
-rw-r--r--tests/org.eclipse.php.core.tests/workspace/errors/php54/testUndefinedVariable4.pdtt9
2 files changed, 10 insertions, 8 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/compiler/ast/validator/VariableValidator.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/compiler/ast/validator/VariableValidator.java
index 8863e79b1..b908e75b4 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/compiler/ast/validator/VariableValidator.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/compiler/ast/validator/VariableValidator.java
@@ -479,14 +479,7 @@ public class VariableValidator implements IValidatorExtension {
}
return false;
}
- Variable var = current.variables.get(name);
- if (var == null) {
- validator.reportProblem(s.start(), s.start() + s.getName().length(),
- NLS.bind(Messages.VariableValidator_IsUndefined, name), PHPProblemIdentifier.UndefinedVariable,
- ProblemSeverity.WARNING);
- } else if (!isInit()) {
- var.setUsed(s.start());
- }
+ check(name, s.start(), s.start() + s.getName().length());
if (s.getIndex() != null) {
operations.push(Operation.USE);
s.getIndex().traverse(this);
diff --git a/tests/org.eclipse.php.core.tests/workspace/errors/php54/testUndefinedVariable4.pdtt b/tests/org.eclipse.php.core.tests/workspace/errors/php54/testUndefinedVariable4.pdtt
new file mode 100644
index 000000000..9fd1d9da3
--- /dev/null
+++ b/tests/org.eclipse.php.core.tests/workspace/errors/php54/testUndefinedVariable4.pdtt
@@ -0,0 +1,9 @@
+--TEST--
+Test undefined arrays with varComment
+--FILE--
+<?php
+/* @var array $var1 */
+ echo $var1[1], $var2;
+?>
+--EXPECT--
+[line=3, start=45, end=50] Variable '$var2' is undefined \ No newline at end of file

Back to the top