| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
We need to unwrap and inline `xs`, then
rewrap the result expression with the wildcard
star.
Addresses the first half of #46.
|
|
|
|
|
|
| |
We use `isExprSafeToInline` from the non-public reflection
API to check. In addtion, we now that an untyped Ident("await$N")
is also an inlinable expression.
|
| |
|
|
|
|
|
|
|
|
|
| |
We can allow it, but we need to treat nested
Apply trees holistically, in order to lift out
all the arguments and maintain the correct
evaluation order.
Fixes #33.
|
|
|
|
|
|
|
|
| |
- If we lift one arg, we must lift them all.
This preserves evaluation order.
- But, never lift an by-name arg
Addresses the first half of #33.
|
|
|
|
|
|
| |
And change TreeInterrogation to set if via this means,
rather than through a direct means, which seems to
assume too much about classloaders.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This augments the on-complete handler for an async state with await as follows:
if (tr.isFailure)
result$async.complete(tr.asInstanceOf[Try[T]])
else {
<resultName> = tr.get.asInstanceOf[<resultType>]
<nextState>
<mkResumeApply>
}
|
|\
| |
| | |
Port futures tests of scala.concurrent
|
| | |
|
| |
| |
| |
| |
| |
| | |
These tests do not use async/await, yet.
Refs #23
|
| | |
|
| |
| |
| |
| |
| |
| | |
We need not, and should not, rename definitions
beyond the scope of the async transform, e.g.
in nested classes of function bodies.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
To avoid suprises in tree retyping, the instance of this
class is immediately upcase to
StateMachine[Promise[T], ExecContext].
Allow nested non-case classes. These pop up when
we use nested async calls.
Only look for duplicate names in the subtrees
traversed by AsyncTraverser.
|
| |
| |
| |
| |
| |
| | |
Adapt the compiler's standard ResetAttrs to keep
This() nodes don't refer to a symbol defined in the
current async block.
|
| |
| |
| |
| |
| |
| |
| |
| | |
There is a fly in the ointment: any This() trees in the provided
code are getting rebound to this class. Sounds like more
resetAttrs fun ahead.
The object also serves as the Future {} thunk.
|
| |
| |
| |
| |
| |
| |
| | |
Any vals referred to in the body of these
must also be lifted.
Fixes #36
|
| |
| |
| |
| |
| |
| | |
The type-checking performed in ANF transform is
precarious, and needed to use the original condition/
scrutinee in a throwaway tree to get things to work.
|
| |
| |
| |
| |
| |
| |
| | |
These gives us something to lift to vars to be accessed
from multiple states of the state machine.
Fixes #35
|
| | |
|
|/
|
|
|
|
|
| |
- Add tests where the result of an await is assigned to a variable external
to the async block.
- Clean up HygieneSpec.
|
| |
|
|
|
|
|
|
| |
Test nested loops.
Control ANF tracing with another system property.
|
|
|
|
| |
Closes #21
|
| |
|
| |
|
| |
|
|
|
|
| |
Lookup the ValDef symbol from Assign#rhs.symbol.
|
| |
|
|
|
|
|
|
|
|
| |
Prepend {(); ... } before starting the ANF transform.
Add tracing to the anf/inline transform.
Also enables and addresses SIP-18 warnings.
|
|
|
|
| |
Why suffer SI-4695 needlessly?
|
|
|
|
|
|
|
|
| |
- transform the provided tree using reflect.internal.Symbols#Symbol.name_=
and treeCopy.{Ident, Select}.
- not sure if this is possible within the public Symbol API.
- move checking for unsupported nested module/class to AsyncAnalysis.
- make block merging selective (only do so if there are nested await calls.)
|
|
|
|
|
|
|
|
| |
- corrects detection of await calls in the ANF transform.
- Split AsyncAnalyzer into two parts. Unsupported await
detection must happen prior to the async transform to
prevent the ANF lifting out by-name arguments to
vals and hence changing the semantics.
|
|
|
|
|
| |
- Move now-working duplicate definition tests from `neg` to `run`.
- Renames and small code beautification around the var lifting analysis
|
| |
|
| |
|
|
|
|
|
|
| |
Accurate reporting of misplaced awaits.
Attempt to collect the minimal set of vars to lift.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of generating an assignment to a Unit-typed variable, just add
the Unit value after the if-else expression:
[async] scala.async.Async.async[Unit]({
val f: scala.concurrent.Future[Int] = AnfTestClass.this.base(y);
if (y.>(0))
State.result_=(scala.async.Async.await[Int](f).+(2))
else
State.result_=(scala.async.Async.await[Int](f).-(2))
})
[async] ANF transform expands to:
{
val f: scala.concurrent.Future[Int] = AnfTestClass.this.base(y);
if (y.>(0))
{
val await$8: Int = scala.async.Async.await[Int](f);
State.result_=(await$8.+(2))
}
else
{
val await$9: Int = scala.async.Async.await[Int](f);
State.result_=(await$9.-(2))
};
()
}
|
|
|
|
|
| |
- Does not descend into class and module defs
- Adds several tests, including tests for if-else
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
- checks that only one function is synthesized
- checks the set of vars created (TODO minimize these)
- use x$1 rather than x1 for the freshened names for lifted vars.
- make execContext a val, not a var.
|
| | |
|
| | |
|
| |
| |
| |
| | |
Works like it says on the box.
|
| |
| |
| |
| | |
Perhaps we should freshen them, but that will be a little awkward in our reify block.
|
| | |
|
| | |
|
| | |
|
| | |
|