intoRaw method

Moves this compiled query into a one-shot logical raw handle.

Implementation

TreeSitterRawHandle<TreeSitterQuery> intoRaw() {
  _checkNotDisposed();
  final moved = TreeSitterQuery(
    capturesByKind,
    capturePatternIndicesByKind: capturePatternIndicesByKind,
    contextualCaptures: contextualCaptures,
    structuralPatterns: structuralPatterns,
    matchPatterns: matchPatterns,
    patternStartBytes: patternStartBytes,
    patternEndBytes: patternEndBytes,
    patternRooted: patternRooted,
    declaredCaptureNames: declaredCaptureNames,
    captureQuantifiersByPattern: captureQuantifiersByPattern,
    patternNonLocal: patternNonLocal,
    guaranteedStepOffsets: guaranteedStepOffsets,
    guaranteedStepValues: guaranteedStepValues,
    generalPredicatesByPattern: generalPredicatesByPattern,
    propertyPredicatesByPattern: propertyPredicatesByPattern,
    propertySettingsByPattern: propertySettingsByPattern,
    predicateStrings: predicateStrings,
    predicateStepsByPattern: predicateStepsByPattern,
    patternCount: _patternCount,
  );
  if (_disabledPatternState[this] case final patterns?) {
    _disabledPatternState[moved] = {...patterns};
  }
  if (_disabledCaptureState[this] case final captures?) {
    _disabledCaptureState[moved] = {...captures};
  }
  dispose();
  return TreeSitterRawHandle<TreeSitterQuery>.owned(moved);
}