function encodeLoc_(loc) {
  var locText = '';
  if (loc.start) {
    locText += loc.start.line + ':' + loc.start.column;
  } else {
    locText += ':';
  }
  locText += '-';
  if (loc.end) {
    if (!loc.start || loc.start.line !== loc.end.line) {
      locText += loc.end.line;
    }
    locText += ':' + loc.end.column;
  } else {
    locText += ':';
  }
  if (loc.source !== undefined) {
    locText += ' ' + encodeURI(loc.source);
  }
  return locText;
}
Compactly serialize the location objects on a Node:
{
  start: {line 1, column: 0},
  end: {line 4, column: 21},
  source: "code"
}
into a string like this: '1:0-4:21 code'
@param {!Object} loc Location object.
@returns {string} Serialized location.