code: function toSourceNodeWhenNeeded(generated, node) {
          if (!sourceMap) {
              // with no source maps, generated is either an
              // array or a string.  if an array, flatten it.
              // if a string, just return it
              if (isArray(generated)) {
                  return flattenToString(generated);
              } else {
                  return generated;
              }
          }
          if (node == null) {
              if (generated instanceof SourceNode) {
                  return generated;
              } else {
                  node = {};
              }
          }
          if (node.loc == null) {
              return new SourceNode(null, null, sourceMap, generated, node.name || null);
          }
          return new SourceNode(node.loc.start.line, node.loc.start.column, (sourceMap === true ? node.loc.source || null : sourceMap), generated, node.name || null);
      }
docs: convert generated to a SourceNode when source maps are enabled.