Skip to content

Commit

Permalink
Partially removed mutability, hopefully eliminating the race for good
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie6 committed Feb 1, 2021
1 parent 3de7871 commit 66834b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private [deepembedding] abstract class Unary[A, B](_p: =>Parsley[A])(pretty: Str
override def preprocess[Cont[_, +_]: ContOps, B_ >: B](implicit seen: Set[Parsley[_]], sub: SubMap,
label: UnsafeOption[String]): Cont[Unit, Parsley[B_]] =
if (label == null && processed) result(this) else for (p <- this.p.optimised) yield {
val self = if (label == null) this else empty(label)
val self = /*if (label == null) this else*/ empty(label)
self.ready(p)
}
private [deepembedding] def ready(p: Parsley[A]): this.type = this.synchronized {
Expand Down Expand Up @@ -76,7 +76,7 @@ private [deepembedding] abstract class Binary[A, B, C](_left: =>Parsley[A], _rig
final override def preprocess[Cont[_, +_]: ContOps, C_ >: C](implicit seen: Set[Parsley[_]], sub: SubMap,
label: UnsafeOption[String]): Cont[Unit, Parsley[C_]] =
if (label == null && processed) result(this) else for (left <- this.left.optimised; right <- this.right.optimised) yield {
val self = if (label == null) this else empty
val self = /*if (label == null) this else*/ empty
self.ready(left, right)
}
private [deepembedding] def ready(left: Parsley[A], right: Parsley[B]): this.type = this.synchronized {
Expand All @@ -103,7 +103,7 @@ private [deepembedding] abstract class Ternary[A, B, C, D](_first: =>Parsley[A],
label: UnsafeOption[String]): Cont[Unit, Parsley[D_]] =
if (label == null && processed) result(this) else
for (first <- this.first.optimised; second <- this.second.optimised; third <- this.third.optimised) yield {
val self = if (label == null) this else empty
val self = /*if (label == null) this else*/ empty
self.ready(first, second, third)
}
private [deepembedding] def ready(first: Parsley[A], second: Parsley[B], third: Parsley[C]): this.type = this.synchronized {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ private [parsley] final class Subroutine[A](_p: =>Parsley[A], val expected: Unsa

override def preprocess[Cont[_, +_]: ContOps, A_ >: A](implicit seen: Set[Parsley[_]], sub: SubMap,
label: UnsafeOption[String]): Cont[Unit, Parsley[A_]] = {
// something is horribly off here!
val self = if (label == null) this else Subroutine(p, label)
if (!processed) for (p <- this.p.optimised(implicitly[ContOps[Cont]], seen, sub, null)) yield self.ready(p)
else result(self)
Expand Down

0 comments on commit 66834b2

Please sign in to comment.