public boolean visit(ForEachStatement foreachStatement) throws Exception {
   if (foreachStatement.getKey() instanceof VariableReference) {
     SimpleReference var = (SimpleReference) foreachStatement.getKey();
     ISourceElementRequestor.FieldInfo info = new ISourceElementRequestor.FieldInfo();
     info.modifiers = Modifiers.AccPublic;
     info.name = var.getName();
     info.nameSourceEnd = var.sourceEnd() - 1;
     info.nameSourceStart = var.sourceStart();
     info.declarationStart = var.sourceStart();
     fRequestor.enterField(info);
     fRequestor.exitField(var.sourceEnd() - 1);
   }
   if (foreachStatement.getValue() instanceof VariableReference) {
     SimpleReference var = (SimpleReference) foreachStatement.getValue();
     ISourceElementRequestor.FieldInfo info = new ISourceElementRequestor.FieldInfo();
     info.modifiers = Modifiers.AccPublic;
     info.name = var.getName();
     info.nameSourceEnd = var.sourceEnd() - 1;
     info.nameSourceStart = var.sourceStart();
     info.declarationStart = var.sourceStart();
     fRequestor.enterField(info);
     fRequestor.exitField(var.sourceEnd() - 1);
   }
   return true;
 }
示例#2
0
 /**
  *
  *
  * <pre>
  * for each (ForDeclaration in Expression ) Statement
  * ForDeclaration : LetOrConst ForBinding
  * </pre>
  */
 @Override
 public List<Name> visit(ForEachStatement node, List<Name> names) {
   if (node.getHead() instanceof LexicalDeclaration) {
     return node.getHead().accept(this, names);
   }
   return names;
 }