diff options
author | Martin Odersky <odersky@gmail.com> | 2016-09-25 12:31:13 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-09-25 16:53:53 +0200 |
commit | 2d908c792fcf4287b4cb493f0e51dfbdb106cf69 (patch) | |
tree | 1e520bbd6f9c52479773bd359deae8a149c7fc97 /src/dotty/tools/dotc/ast/Desugar.scala | |
parent | b2b475d2931f71220d0ed5390ec77608ca3d150e (diff) | |
download | dotty-2d908c792fcf4287b4cb493f0e51dfbdb106cf69.tar.gz dotty-2d908c792fcf4287b4cb493f0e51dfbdb106cf69.tar.bz2 dotty-2d908c792fcf4287b4cb493f0e51dfbdb106cf69.zip |
Drop Pair
Drop tree node class 'Pair'. It was used only in imports, where
it can easily be replaced by Thicket.
The envisaged use for generic pairs is almost sure better modelled
by a "Pair" class in Dotty's standard library.
Diffstat (limited to 'src/dotty/tools/dotc/ast/Desugar.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/Desugar.scala | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala index 1bfbcdbeb..edd6da5c9 100644 --- a/src/dotty/tools/dotc/ast/Desugar.scala +++ b/src/dotty/tools/dotc/ast/Desugar.scala @@ -11,10 +11,6 @@ import collection.mutable.ListBuffer import util.Attachment object desugar { - - /** Are we using the new unboxed pair scheme? */ - private final val unboxedPairs = false - import untpd._ /** Tags a .withFilter call generated by desugaring a for expression. @@ -923,25 +919,15 @@ object desugar { case Parens(t) => t case Tuple(ts) => - if (unboxedPairs) { - def PairTypeTree(l: Tree, r: Tree) = - AppliedTypeTree(ref(defn.PairType), l :: r :: Nil) - if (ctx.mode is Mode.Type) ts.reduceRight(PairTypeTree) - else if (ts.isEmpty) unitLiteral - else ts.reduceRight(Pair(_, _)) - } - else { - val arity = ts.length - def tupleTypeRef = defn.TupleType(arity) - if (arity > Definitions.MaxTupleArity) { - ctx.error(s"tuple too long (max allowed: ${Definitions.MaxTupleArity})", tree.pos) - unitLiteral - } - else if (arity == 1) ts.head - else if (ctx.mode is Mode.Type) AppliedTypeTree(ref(tupleTypeRef), ts) - else if (arity == 0) unitLiteral - else Apply(ref(tupleTypeRef.classSymbol.companionModule.valRef), ts) - } + val arity = ts.length + def tupleTypeRef = defn.TupleType(arity) + if (arity > Definitions.MaxTupleArity) { + ctx.error(s"tuple too long (max allowed: ${Definitions.MaxTupleArity})", tree.pos) + unitLiteral + } else if (arity == 1) ts.head + else if (ctx.mode is Mode.Type) AppliedTypeTree(ref(tupleTypeRef), ts) + else if (arity == 0) unitLiteral + else Apply(ref(tupleTypeRef.classSymbol.companionModule.valRef), ts) case WhileDo(cond, body) => // { <label> def while$(): Unit = if (cond) { body; while$() } ; while$() } val call = Apply(Ident(nme.WHILE_PREFIX), Nil) @@ -1048,9 +1034,6 @@ object desugar { add(id, TypeTree()) case Apply(_, args) => args foreach collect - case Pair(left, right) => - collect(left) - collect(right) case Typed(expr, _) => collect(expr) case NamedArg(_, arg) => |