From 3c7936515a9aaf383b453fe5844598fd53a2e551 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 17 Jun 2013 01:25:14 +0200 Subject: Added typer.Mode Replaces desugar.Mode. Is now a value class representing a set. --- src/dotty/tools/dotc/typer/Modes.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/dotty/tools/dotc/typer/Modes.scala (limited to 'src/dotty/tools/dotc/typer/Modes.scala') diff --git a/src/dotty/tools/dotc/typer/Modes.scala b/src/dotty/tools/dotc/typer/Modes.scala new file mode 100644 index 000000000..edcbc79b4 --- /dev/null +++ b/src/dotty/tools/dotc/typer/Modes.scala @@ -0,0 +1,18 @@ +package dotty.tools.dotc.typer + +case class Mode(val bits: Int) extends AnyVal { + def | (that: Mode) = Mode(bits | that.bits) + def & (that: Mode) = Mode(bits & that.bits) + def &~ (that: Mode) = Mode(bits & ~that.bits) + def is (that: Mode) = (bits & that.bits) == that.bits +} + +object Mode { + val None = Mode(1 << 0) + + val Expr = Mode(1 << 1) + val Pattern = Mode(1 << 2) + val Type = Mode(1 << 3) + + +} \ No newline at end of file -- cgit v1.2.3