diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-11-23 23:30:22 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-11-23 23:30:22 +0100 |
commit | d193065827c40002de1e56c316eb026907536c17 (patch) | |
tree | 258edc000ec085e3888d04a812440200badc4718 /src/main/scala | |
parent | 7253b5e7a62e0e255a3fece591b7b5991a24d3a9 (diff) | |
download | scala-async-d193065827c40002de1e56c316eb026907536c17.tar.gz scala-async-d193065827c40002de1e56c316eb026907536c17.tar.bz2 scala-async-d193065827c40002de1e56c316eb026907536c17.zip |
Explicitly prohibit await in nested methods.
Diffstat (limited to 'src/main/scala')
-rw-r--r-- | src/main/scala/scala/async/AsyncAnalysis.scala | 4 | ||||
-rw-r--r-- | src/main/scala/scala/async/TransformUtils.scala | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/main/scala/scala/async/AsyncAnalysis.scala b/src/main/scala/scala/async/AsyncAnalysis.scala index 9e24130..38fd22f 100644 --- a/src/main/scala/scala/async/AsyncAnalysis.scala +++ b/src/main/scala/scala/async/AsyncAnalysis.scala @@ -45,6 +45,10 @@ private[async] final case class AsyncAnalysis[C <: Context](override val c: C) e } } + override def nestedMethod(module: DefDef) { + reportUnsupportedAwait(module, "nested method") + } + override def byNameArgument(arg: Tree) { reportUnsupportedAwait(arg, "by-name argument") } diff --git a/src/main/scala/scala/async/TransformUtils.scala b/src/main/scala/scala/async/TransformUtils.scala index e37f66d..5095875 100644 --- a/src/main/scala/scala/async/TransformUtils.scala +++ b/src/main/scala/scala/async/TransformUtils.scala @@ -37,6 +37,9 @@ class TransformUtils[C <: Context](val c: C) { def nestedModule(module: ModuleDef) { } + def nestedMethod(module: DefDef) { + } + def byNameArgument(arg: Tree) { } @@ -47,6 +50,7 @@ class TransformUtils[C <: Context](val c: C) { tree match { case cd: ClassDef => nestedClass(cd) case md: ModuleDef => nestedModule(md) + case dd: DefDef => nestedMethod(dd) case fun: Function => function(fun) case Apply(fun, args) => val isInByName = isByName(fun) |