StringTokenImpl.fromUtf8Bytes constructor

StringTokenImpl.fromUtf8Bytes(
  1. TokenType type,
  2. List<int> data,
  3. int start,
  4. int end,
  5. bool asciiOnly,
  6. int charOffset, {
  7. CommentToken? precedingComments,
})

Creates a lazy string token. If asciiOnly is false, the byte array is passed through a UTF-8 decoder.

Implementation

StringTokenImpl.fromUtf8Bytes(TokenType type, List<int> data, int start,
    int end, bool asciiOnly, int charOffset,
    {CommentToken? precedingComments})
    : super(type, charOffset, precedingComments) {
  int length = end - start;
  if (length <= LAZY_THRESHOLD) {
    valueOrLazySubstring = decodeUtf8(data, start, end, asciiOnly);
  } else {
    valueOrLazySubstring = new _LazySubstring(data, start, length, asciiOnly);
  }
}