diff options
author | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-02-05 16:07:06 +0100 |
---|---|---|
committer | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-02-07 17:19:07 +0100 |
commit | 31c5310da39cab33bf37f555777eaa51cf1de820 (patch) | |
tree | ec89cb929178a8a9a17ab664cc338d0252fe7f1e /src/reflect | |
parent | 947baf2473a1f797545147e551740900013e5b1d (diff) | |
download | scala-31c5310da39cab33bf37f555777eaa51cf1de820.tar.gz scala-31c5310da39cab33bf37f555777eaa51cf1de820.tar.bz2 scala-31c5310da39cab33bf37f555777eaa51cf1de820.zip |
Use more specific return type for SyntacticFunction
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/api/BuildUtils.scala | 4 | ||||
-rw-r--r-- | src/reflect/scala/reflect/internal/BuildUtils.scala | 7 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/reflect/scala/reflect/api/BuildUtils.scala b/src/reflect/scala/reflect/api/BuildUtils.scala index 7aaa3973b3..f2932792dd 100644 --- a/src/reflect/scala/reflect/api/BuildUtils.scala +++ b/src/reflect/scala/reflect/api/BuildUtils.scala @@ -198,9 +198,9 @@ private[reflect] trait BuildUtils { self: Universe => val SyntacticFunction: SyntacticFunctionExtractor trait SyntacticFunctionExtractor { - def apply(params: List[Tree], body: Tree): Tree + def apply(params: List[Tree], body: Tree): Function - def unapply(tree: Tree): Option[(List[ValDef], Tree)] + def unapply(tree: Function): Option[(List[ValDef], Tree)] } val SyntacticDefDef: SyntacticDefDefExtractor diff --git a/src/reflect/scala/reflect/internal/BuildUtils.scala b/src/reflect/scala/reflect/internal/BuildUtils.scala index 458c10e69b..9281367138 100644 --- a/src/reflect/scala/reflect/internal/BuildUtils.scala +++ b/src/reflect/scala/reflect/internal/BuildUtils.scala @@ -435,16 +435,13 @@ trait BuildUtils { self: SymbolTable => } object SyntacticFunction extends SyntacticFunctionExtractor { - def apply(params: List[Tree], body: Tree): Tree = { + def apply(params: List[Tree], body: Tree): Function = { val params0 :: Nil = mkParam(params :: Nil, PARAM) require(params0.forall { _.rhs.isEmpty }, "anonymous functions don't support parameters with default values") Function(params0, body) } - def unapply(tree: Tree): Option[(List[ValDef], Tree)] = tree match { - case Function(params, body) => Some((params, body)) - case _ => None - } + def unapply(tree: Function): Option[(List[ValDef], Tree)] = Function.unapply(tree) } object SyntacticNew extends SyntacticNewExtractor { |