code: private GroovyExpression addCallToUpdateResultVariable(GroovyExpression expr,List<LiteralExpression> aliasNames, OptimizationContext context) {
  
          GroovyExpression result = expr;
          // If there is one range expression in the unoptimized gremlin,
          // add a range expression here so that the intermediate variable will only contain
          // the specified range of vertices.
          AbstractFunctionExpression rangeExpression = context.getRangeExpression();
          if (rangeExpression != null) {
              int[] rangeParameters = factory.getRangeParameters(rangeExpression);
              result = factory.generateRangeExpression(result, rangeParameters[0], rangeParameters[1]);
          }
          if( ! aliasNames.isEmpty()) {
              result = factory.generateSelectExpression(result, aliasNames, Collections.<GroovyExpression>emptyList());
          }
          return factory.generateFillExpression(result, context.getResultVariable());
      }
docs: This method adds steps to the end of the initial traversal to add the vertices
  that were found into an intermediate variable (defined as a Set).  If there is one alias,
  this set will contain the vertices associated with that Alias.  If there are multiple
  aliases, the values in the set will be alias->vertex maps that have the vertex
  associated with the alias for each result.
  
  @param expr
  @param aliasNames
  @param context
  @return