@@ -97,11 +97,11 @@ public struct ConcurrentEdits {
9797
9898 /// The raw concurrent edits. Are guaranteed to satisfy the requirements
9999 /// stated above.
100- public let edits : [ SourceEdit ]
100+ public let edits : [ IncrementalEdit ]
101101
102102 /// Initialize this struct from edits that are already in a concurrent form
103103 /// and are guaranteed to satisfy the requirements posed above.
104- public init ( concurrent: [ SourceEdit ] ) throws {
104+ public init ( concurrent: [ IncrementalEdit ] ) throws {
105105 if !Self. isValidConcurrentEditArray ( concurrent) {
106106 throw ConcurrentEditsError . editsNotConcurrent
107107 }
@@ -117,7 +117,7 @@ public struct ConcurrentEdits {
117117 /// - insert 'z' at offset 2
118118 /// to '012345' results in 'xyz012345'.
119119
120- public init ( fromSequential sequentialEdits: [ SourceEdit ] ) {
120+ public init ( fromSequential sequentialEdits: [ IncrementalEdit ] ) {
121121 do {
122122 try self . init ( concurrent: Self . translateSequentialEditsToConcurrentEdits ( sequentialEdits) )
123123 } catch {
@@ -128,7 +128,7 @@ public struct ConcurrentEdits {
128128 /// Construct a concurrent edits struct from a single edit. For a single edit,
129129 /// there is no differentiation between being it being applied concurrently
130130 /// or sequentially.
131- public init ( _ single: SourceEdit ) {
131+ public init ( _ single: IncrementalEdit ) {
132132 do {
133133 try self . init ( concurrent: [ single] )
134134 } catch {
@@ -137,24 +137,24 @@ public struct ConcurrentEdits {
137137 }
138138
139139 private static func translateSequentialEditsToConcurrentEdits(
140- _ edits: [ SourceEdit ]
141- ) -> [ SourceEdit ] {
142- var concurrentEdits : [ SourceEdit ] = [ ]
140+ _ edits: [ IncrementalEdit ]
141+ ) -> [ IncrementalEdit ] {
142+ var concurrentEdits : [ IncrementalEdit ] = [ ]
143143 for editToAdd in edits {
144144 var editToAdd = editToAdd
145145 var editIndiciesMergedWithNewEdit : [ Int ] = [ ]
146146 for (index, existingEdit) in concurrentEdits. enumerated ( ) {
147147 if existingEdit. replacementRange. intersectsOrTouches ( editToAdd. range) {
148148 let intersectionLength =
149149 existingEdit. replacementRange. intersected ( editToAdd. range) . length
150- editToAdd = SourceEdit (
150+ editToAdd = IncrementalEdit (
151151 offset: Swift . min ( existingEdit. offset, editToAdd. offset) ,
152152 length: existingEdit. length + editToAdd. length - intersectionLength,
153153 replacementLength: existingEdit. replacementLength + editToAdd. replacementLength - intersectionLength
154154 )
155155 editIndiciesMergedWithNewEdit. append ( index)
156156 } else if existingEdit. offset < editToAdd. endOffset {
157- editToAdd = SourceEdit (
157+ editToAdd = IncrementalEdit (
158158 offset: editToAdd. offset - existingEdit. replacementLength + existingEdit. length,
159159 length: editToAdd. length,
160160 replacementLength: editToAdd. replacementLength
@@ -175,7 +175,7 @@ public struct ConcurrentEdits {
175175 return concurrentEdits
176176 }
177177
178- private static func isValidConcurrentEditArray( _ edits: [ SourceEdit ] ) -> Bool {
178+ private static func isValidConcurrentEditArray( _ edits: [ IncrementalEdit ] ) -> Bool {
179179 // Not quite sure if we should disallow creating an `IncrementalParseTransition`
180180 // object without edits but there doesn't seem to be much benefit if we do,
181181 // and there are 'lit' tests that want to test incremental re-parsing without edits.
@@ -195,7 +195,7 @@ public struct ConcurrentEdits {
195195 }
196196
197197 /// **Public for testing purposes only**
198- public static func _isValidConcurrentEditArray( _ edits: [ SourceEdit ] ) -> Bool {
198+ public static func _isValidConcurrentEditArray( _ edits: [ IncrementalEdit ] ) -> Bool {
199199 return isValidConcurrentEditArray ( edits)
200200 }
201201}
0 commit comments