8000 Fix #1120: Rewire mutable.Buffer.newBuilder to js.WrappedArray. · scala-js/scala-js@757949e · GitHub
[go: up one dir, main page]

Skip to content

Commit 757949e

Browse files
committed
Fix #1120: Rewire mutable.Buffer.newBuilder to js.WrappedArray.
1 parent e4b4fea commit 757949e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

scalalib/overrides-2.10/scala/collection/mutable/Buffer.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ package mutable
1313

1414
import generic._
1515

16+
import scala.scalajs.js
17+
1618
/** Buffers are used to create sequences of elements incrementally by
1719
* appending, prepending, or inserting new elements. It is also
1820
* possible to access and modify elements in a random access fashion
@@ -41,7 +43,7 @@ trait Buffer[A] extends Seq[A]
4143
*/
4244
object Buffer extends SeqFactory[Buffer] {
4345
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Buffer[A]] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]]
44-
def newBuilder[A]: Builder[A, Buffer[A]] = new ArrayBuffer
46+
def newBuilder[A]: Builder[A, Buffer[A]] = new js.WrappedArray
4547
}
4648

4749
/** Explicit instantiation of the `Buffer` trait to reduce class file size in subclasses. */

scalalib/overrides-2.11/scala/collection/mutable/Buffer.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ package mutable
1414

1515
import generic._
1616

17+
import scala.scalajs.js
18+
1719
/** Buffers are used to create sequences of elements incrementally by
1820
* appending, prepending, or inserting new elements. It is also
1921
* possible to access and modify elements in a random access fashion
@@ -42,7 +44,7 @@ trait Buffer[A] extends Seq[A]
4244
*/
4345
object Buffer extends SeqFactory[Buffer] {
4446
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Buffer[A]] = ReusableCBF.asInstanceOf[GenericCanBuildFrom[A]]
45-
def newBuilder[A]: Builder[A, Buffer[A]] = new ArrayBuffer
47+
def newBuilder[A]: Builder[A, Buffer[A]] = new js.WrappedArray
4648
}
4749

4850
/** Explicit instantiation of the `Buffer` trait to reduce class file size in subclasses. */

0 commit comments

Comments
 (0)
0