aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--src/main/scala/scala/async/internal/AsyncTransform.scala4
-rw-r--r--src/main/scala/scala/async/internal/ExprBuilder.scala16
3 files changed, 12 insertions, 10 deletions
diff --git a/README.md b/README.md
index 10c71f4..09a40c4 100644
--- a/README.md
+++ b/README.md
@@ -136,7 +136,7 @@ difficult to understand.
- Logging of the transform can be enabled with `scalac -Dscala.async.debug=true`.
- Tracing of the ANF transform: `scalac -Dscala.async.trace=true`
- Debug the macro expansion by checking out the project and executing the application
- [`TreeInterrogation`](https://github.com/scala/async/blob/master/src/test/scala/scala/async/TreeInterrogation.scala#L59)
+ [`scala.async.TreeInterrogation`](https://github.com/scala/async/blob/master/src/test/scala/scala/async/TreeInterrogation.scala#L59)
## Limitations
- See the [neg](https://github.com/scala/async/tree/master/src/test/scala/scala/async/neg) test cases for
diff --git a/src/main/scala/scala/async/internal/AsyncTransform.scala b/src/main/scala/scala/async/internal/AsyncTransform.scala
index 78a0876..43e4a9c 100644
--- a/src/main/scala/scala/async/internal/AsyncTransform.scala
+++ b/src/main/scala/scala/async/internal/AsyncTransform.scala
@@ -10,12 +10,12 @@ trait AsyncTransform {
// We annotate the type of the whole expression as `T @uncheckedBounds` so as not to introduce
// warnings about non-conformant LUBs. See SI-7694
- // This implicit propatages the annotated type in the type tag.
+ // This implicit propagates the annotated type in the type tag.
implicit val uncheckedBoundsResultTag: WeakTypeTag[T] = WeakTypeTag[T](rootMirror, FixedMirrorTypeCreator(rootMirror, uncheckedBounds(resultType.tpe)))
reportUnsupportedAwaits(body, report = !cpsFallbackEnabled)
- // Transform to A-normal form:
+ // Transform to A-normal form:
// - no await calls in qualifiers or arguments,
// - if/match only used in statement position.
val anfTree: Block = anfTransform(body)
diff --git a/src/main/scala/scala/async/internal/ExprBuilder.scala b/src/main/scala/scala/async/internal/ExprBuilder.scala
index 3bde51a..2e3a017 100644
--- a/src/main/scala/scala/async/internal/ExprBuilder.scala
+++ b/src/main/scala/scala/async/internal/ExprBuilder.scala
@@ -42,7 +42,7 @@ trait ExprBuilder {
}
}
- /** A sequence of statements the concludes with a unconditional transition to `nextState` */
+ /** A sequence of statements that concludes with a unconditional transition to `nextState` */
final class SimpleAsyncState(val stats: List[Tree], val state: Int, nextState: Int, symLookup: SymLookup)
extends AsyncState {
@@ -65,7 +65,7 @@ trait ExprBuilder {
}
/** A sequence of statements that concludes with an `await` call. The `onComplete`
- * handler will unconditionally transition to `nestState`.``
+ * handler will unconditionally transition to `nextState`.
*/
final class AsyncStateWithAwait(val stats: List[Tree], val state: Int, nextState: Int,
val awaitable: Awaitable, symLookup: SymLookup)
@@ -110,7 +110,7 @@ trait ExprBuilder {
}
/*
- * Builder for a single state of an async method.
+ * Builder for a single state of an async expression.
*/
final class AsyncStateBuilder(state: Int, private val symLookup: SymLookup) {
/* Statements preceding an await call. */
@@ -123,9 +123,10 @@ trait ExprBuilder {
def addStat() = stats += stat
stat match {
case Apply(fun, Nil) =>
+ // labelDefStates belongs to the current ExprBuilder
labelDefStates get fun.symbol match {
- case Some(nextState) => nextJumpState = Some(nextState)
- case None => addStat()
+ case opt @ Some(nextState) => nextJumpState = opt // re-use object
+ case None => addStat()
}
case _ => addStat()
}
@@ -258,7 +259,7 @@ trait ExprBuilder {
currState = afterMatchState
stateBuilder = new AsyncStateBuilder(currState, symLookup)
- case ld@LabelDef(name, params, rhs) if rhs exists isAwait =>
+ case ld @ LabelDef(name, params, rhs) if rhs exists isAwait =>
val startLabelState = nextState()
val afterLabelState = nextState()
asyncStates += stateBuilder.resultWithLabel(startLabelState, symLookup)
@@ -268,7 +269,8 @@ trait ExprBuilder {
currState = afterLabelState
stateBuilder = new AsyncStateBuilder(currState, symLookup)
- case _ =>
+
+ case _ =>
checkForUnsupportedAwait(stat)
stateBuilder += stat
}