summaryrefslogtreecommitdiff
path: root/src/interactive/scala/tools/nsc/interactive/RichCompilationUnits.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-03-06 08:05:12 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-03-09 11:59:11 -0800
commite83defaa29bf8d7ed742a611c301ee8b04e971b8 (patch)
tree3dbacf0cde8a4a8801b3a40a685ffd8ac6c624b0 /src/interactive/scala/tools/nsc/interactive/RichCompilationUnits.scala
parentc6ca941ccc017a8869f4def717cfeb640f965077 (diff)
downloadscala-e83defaa29bf8d7ed742a611c301ee8b04e971b8.tar.gz
scala-e83defaa29bf8d7ed742a611c301ee8b04e971b8.tar.bz2
scala-e83defaa29bf8d7ed742a611c301ee8b04e971b8.zip
Moved interactive sources into separate directory.
As with the preceding commit, this has build-internal effects only.
Diffstat (limited to 'src/interactive/scala/tools/nsc/interactive/RichCompilationUnits.scala')
-rw-r--r--src/interactive/scala/tools/nsc/interactive/RichCompilationUnits.scala58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/interactive/scala/tools/nsc/interactive/RichCompilationUnits.scala b/src/interactive/scala/tools/nsc/interactive/RichCompilationUnits.scala
new file mode 100644
index 0000000000..b83c2cd095
--- /dev/null
+++ b/src/interactive/scala/tools/nsc/interactive/RichCompilationUnits.scala
@@ -0,0 +1,58 @@
+/* NSC -- new Scala compiler
+ * Copyright 2009-2013 Typesafe/Scala Solutions and LAMP/EPFL
+ * @author Martin Odersky
+ */
+package scala.tools.nsc
+package interactive
+
+import scala.reflect.internal.util.{SourceFile, Position, NoPosition}
+import scala.collection.mutable.ArrayBuffer
+
+trait RichCompilationUnits { self: Global =>
+
+ /** The status value of a unit that has not yet been loaded */
+ final val NotLoaded = -2
+
+ /** The status value of a unit that has not yet been typechecked */
+ final val JustParsed = -1
+
+ /** The status value of a unit that has been partially typechecked */
+ final val PartiallyChecked = 0
+
+ class RichCompilationUnit(source: SourceFile) extends CompilationUnit(source) {
+
+ /** The runid of the latest compiler run that typechecked this unit,
+ * or else @see NotLoaded, JustParsed
+ */
+ var status: Int = NotLoaded
+
+ /** Unit has been parsed */
+ def isParsed: Boolean = status >= JustParsed
+
+ /** Unit has been typechecked, but maybe not in latest runs */
+ def isTypeChecked: Boolean = status > JustParsed
+
+ /** Unit has been typechecked and is up to date */
+ def isUpToDate: Boolean = status >= minRunId
+
+ /** the current edit point offset */
+ var editPoint: Int = -1
+
+ /** The problems reported for this unit */
+ val problems = new ArrayBuffer[Problem]
+
+ /** The position of a targeted type check
+ * If this is different from NoPosition, the type checking
+ * will stop once a tree that contains this position range
+ * is fully attributed.
+ */
+ var _targetPos: Position = NoPosition
+ override def targetPos: Position = _targetPos
+ def targetPos_=(p: Position) { _targetPos = p }
+
+ var contexts: Contexts = new Contexts
+
+ /** The last fully type-checked body of this unit */
+ var lastBody: Tree = EmptyTree
+ }
+}