Skip to content

Commit

Permalink
Make it compile with scala 2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
satabin committed Jun 26, 2023
1 parent 3ba90b3 commit 4c29e68
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
32 changes: 32 additions & 0 deletions json/src/main/scala-2.12/fs2/data/package.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2023 Lucas Satabin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package fs2

import scala.collection.immutable.VectorBuilder
import scala.collection.mutable.ListBuffer

package object data {

implicit class VectorBuilderOps[T](val builder: VectorBuilder[T]) extends AnyVal {
def addOne(t: T) = builder += t
}

implicit class ListBufferOps[T](val buffer: ListBuffer[T]) extends AnyVal {
def addOne(t: T) = buffer += t
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ package internals
* chunk under construction, but results still being built are kept.
* This allows to accumulate values acros upstream chunk boundaries.
*/
private[internals] trait ChunkAccumulator[Res] {
private[json] trait ChunkAccumulator[Res] {

def startObject(): this.type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private[json] class LegacyTokenParser[F[_], T, Res](s: Stream[F, T])(implicit
number_(context, state, acc, chunkAcc)
case None =>
if (NumberState.isFinal(state))
Pull.pure(T.create(Stream.empty), chunkAcc.numberValue(acc.result()))
Pull.pure((T.create(Stream.empty), chunkAcc.numberValue(acc.result())))
else
Pull.raiseError[F](new JsonException("unexpected end of input"))
}
Expand Down

0 comments on commit 4c29e68

Please sign in to comment.