diff options
author | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-02-28 14:38:31 +0100 |
---|---|---|
committer | Denys Shabalin <denys.shabalin@typesafe.com> | 2014-03-09 15:47:26 +0200 |
commit | 1b5a34b402cb283db6029a1d54778390ba14ef6f (patch) | |
tree | a95fada473ac1a64cd1579b58741835cb8196419 /src/reflect | |
parent | 67d175f06db62e8af18851fc5694cfff2158d73b (diff) | |
download | scala-1b5a34b402cb283db6029a1d54778390ba14ef6f.tar.gz scala-1b5a34b402cb283db6029a1d54778390ba14ef6f.tar.bz2 scala-1b5a34b402cb283db6029a1d54778390ba14ef6f.zip |
Address pull request feedback
1. Tighten up the if else to avoid duplication
2. Add doc comments
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/internal/ReificationSupport.scala | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/ReificationSupport.scala b/src/reflect/scala/reflect/internal/ReificationSupport.scala index 9a47bab37c..dfe1811ff0 100644 --- a/src/reflect/scala/reflect/internal/ReificationSupport.scala +++ b/src/reflect/scala/reflect/internal/ReificationSupport.scala @@ -201,6 +201,9 @@ trait ReificationSupport { self: SymbolTable => def unapply(flags: Long): Some[Long] = Some(flags) } + /** Construct/deconstruct type application term trees. + * Treats other term trees as zero-argument type applications. + */ object SyntacticTypeApplied extends SyntacticTypeAppliedExtractor { def apply(tree: Tree, targs: List[Tree]): Tree = if (targs.isEmpty) tree @@ -214,6 +217,9 @@ trait ReificationSupport { self: SymbolTable => } } + /** Construct/deconstruct applied type trees. + * Treats other types as zero-arity applied types. + */ object SyntacticAppliedType extends SyntacticTypeAppliedExtractor { def apply(tree: Tree, targs: List[Tree]): Tree = if (targs.isEmpty) tree @@ -235,10 +241,10 @@ trait ReificationSupport { self: SymbolTable => case UnApply(treeInfo.Unapplied(Select(fun, nme.unapply)), pats) => Some((fun, pats :: Nil)) case treeInfo.Applied(fun, targs, argss) => - if (fun.isTerm) - Some((SyntacticTypeApplied(fun, targs), argss)) - else - Some((SyntacticAppliedType(fun, targs), argss)) + val callee = + if (fun.isTerm) SyntacticTypeApplied(fun, targs) + else SyntacticAppliedType(fun, targs) + Some((callee, argss)) } } |