public boolean endvisit(Assignment assignment) throws Exception { if (!fNodes.isEmpty() && fNodes.peek() == assignment) { fRequestor.exitField(assignment.sourceEnd() - 1); fNodes.pop(); } return true; }
public boolean visit(Assignment assignment) throws Exception { final Expression left = assignment.getVariable(); if (left instanceof FieldAccess) { // class variable ($this->a = .) final FieldAccess fieldAccess = (FieldAccess) left; final Expression dispatcher = fieldAccess.getDispatcher(); if (dispatcher instanceof VariableReference && "$this".equals(((VariableReference) dispatcher).getName())) { // $NON-NLS-1$ final Expression field = fieldAccess.getField(); if (field instanceof SimpleReference) { final SimpleReference ref = (SimpleReference) field; final ISourceElementRequestor.FieldInfo info = new ISourceElementRequestor.FieldInfo(); info.modifiers = Modifiers.AccPublic; info.name = '$' + ref.getName(); info.nameSourceEnd = ref.sourceEnd() - 1; info.nameSourceStart = ref.sourceStart(); info.declarationStart = assignment.sourceStart(); fRequestor.enterField(info); fNodes.push(assignment); } } } else if (left instanceof VariableReference) { if (!declarations.empty()) { final Declaration parentDeclaration = declarations.peek(); if (parentDeclaration instanceof MethodDeclaration && methodGlobalVars.peek().contains(((VariableReference) left).getName()) || parentDeclaration == fLastNamespace) { deferredDeclarations.add(assignment); return false; } } final ISourceElementRequestor.FieldInfo info = new ISourceElementRequestor.FieldInfo(); info.modifiers = Modifiers.AccPublic; info.name = ((VariableReference) left).getName(); info.nameSourceEnd = left.sourceEnd() - 1; info.nameSourceStart = left.sourceStart(); info.declarationStart = assignment.sourceStart(); fRequestor.enterField(info); fNodes.push(assignment); } return true; }