Fix #1368081: Variable not initialized does not work for array access
authoraxelcl <axelcl>
Mon, 19 Dec 2005 21:57:02 +0000 (21:57 +0000)
committeraxelcl <axelcl>
Mon, 19 Dec 2005 21:57:02 +0000 (21:57 +0000)
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java

index 3c7c661..7314c8d 100644 (file)
@@ -3126,7 +3126,11 @@ public class Parser implements ITerminalSymbols, CompilerModifiers, ParserBasicI
                        } else if (token == TokenNameLBRACKET) {
                                if (ref != null && ref instanceof FieldReference) {
                                        FieldReference fref = (FieldReference) ref;
-                                       addVariableSet(fref.token);
+                                       if (!containsVariableSet(fref.token)) {
+                                               problemReporter.uninitializedLocalVariable(new String(fref.token), fref.sourceStart(), fref.sourceEnd(),
+                                                               referenceContext, compilationUnit.compilationResult);
+                                               addVariableSet(fref.token);
+                                       }
                                }
                                ref = null;
                                getNextToken();