Program: 145706
Project: 145706
Buggy source:
@Override public boolean visit(AstNode an){
  if (an == node) {
    return true;
  }
  if (an instanceof FunctionNode) {
    return false;
  }
  if (an instanceof VariableDeclaration) {
    VariableDeclaration variableDeclaration=(VariableDeclaration)an;
    if (variableDeclaration.getVariables() != null) {
      for (      VariableInitializer variableInitializer : variableDeclaration.getVariables()) {
        if (variableInitializer.getTarget() != null && variableInitializer.getTarget().getString().equals(fieldName) && variableInitializer.getInitializer() != null) {
          if (variableInitializer.getInitializer() instanceof NewExpression) {
            NewExpression ne=(NewExpression)variableInitializer.getInitializer();
            if (ne.getTarget() != null) {
              if (isModuleInitializerName(ne.getTarget().getString()) && ne.getArguments() != null && ne.getArguments().size() > 0) {
                ctx=getModuleCompletionContext(stripElementId(ne.getArguments().get(0).toSource()));
                return false;
              }
              for (              ScriptClassProvider scp : Lookup.getDefault().lookupAll(ScriptClassProvider.class)) {
                Class clazz=scp.getClassByName(ne.getTarget().getString());
                if (clazz != null) {
                  ctx=new CompletionContext(clazz);
                  return false;
                }
              }
              CompletionContext cc=getModuleCompletionContext(stripElementId(ne.getTarget().getString()));
              if (cc != null) {
                ctx=cc;
                return false;
              }
            }
          }
 else           if (variableInitializer.getInitializer() instanceof FunctionCall) {
            FunctionCall fc=(FunctionCall)variableInitializer.getInitializer();
            if (fc.getTarget() instanceof PropertyGet) {
              PropertyGet pg=(PropertyGet)fc.getTarget();
              if (pg.getLeft().getString().equals(MODULES_OBJECT_NAME) && pg.getRight().getString().equals(GET_METHOD_NAME)) {
                if (fc.getArguments() != null && fc.getArguments().size() > 0) {
                  ctx=getModuleCompletionContext(stripElementId(fc.getArguments().get(0).toSource()));
                  return false;
                }
              }
            }
          }
        }
      }
    }
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean visit(AstNode an){
  if (an == node) {
    return true;
  }
  if (an instanceof FunctionNode) {
    return false;
  }
  if (an instanceof VariableDeclaration) {
    VariableDeclaration variableDeclaration=(VariableDeclaration)an;
    if (variableDeclaration.getVariables() != null) {
      for (      VariableInitializer variableInitializer : variableDeclaration.getVariables()) {
        if (variableInitializer.getTarget() != null && variableInitializer.getTarget().getString().equals(fieldName) && variableInitializer.getInitializer() != null) {
          if (variableInitializer.getInitializer() instanceof NewExpression) {
            NewExpression ne=(NewExpression)variableInitializer.getInitializer();
            if (ne.getTarget() != null && ne.getTarget() instanceof Name) {
              if (isModuleInitializerName(ne.getTarget().getString()) && ne.getArguments() != null && ne.getArguments().size() > 0) {
                ctx=getModuleCompletionContext(stripElementId(ne.getArguments().get(0).toSource()));
                return false;
              }
              for (              ScriptClassProvider scp : Lookup.getDefault().lookupAll(ScriptClassProvider.class)) {
                Class clazz=scp.getClassByName(ne.getTarget().getString());
                if (clazz != null) {
                  ctx=new CompletionContext(clazz);
                  return false;
                }
              }
              CompletionContext cc=getModuleCompletionContext(stripElementId(ne.getTarget().getString()));
              if (cc != null) {
                ctx=cc;
                return false;
              }
            }
          }
 else           if (variableInitializer.getInitializer() instanceof FunctionCall) {
            FunctionCall fc=(FunctionCall)variableInitializer.getInitializer();
            if (fc.getTarget() instanceof PropertyGet) {
              PropertyGet pg=(PropertyGet)fc.getTarget();
              if (pg.getLeft().getString().equals(MODULES_OBJECT_NAME) && pg.getRight().getString().equals(GET_METHOD_NAME)) {
                if (fc.getArguments() != null && fc.getArguments().size() > 0) {
                  ctx=getModuleCompletionContext(stripElementId(fc.getArguments().get(0).toSource()));
                  return false;
                }
              }
            }
          }
        }
      }
    }
    return false;
  }
  return true;
}