aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/pickling/PickleFormat.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-02-26 14:57:15 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-03-18 11:14:10 +0100
commitbfa5e46d4cddd4b544c77bcef577c837fd403aad (patch)
treeca0bc41ad24991ba8ef467134fff2cab6684ee6c /src/dotty/tools/dotc/core/pickling/PickleFormat.scala
parent1b301e9b8da1fc48b1720cccedafdb7cdb7058a4 (diff)
downloaddotty-bfa5e46d4cddd4b544c77bcef577c837fd403aad.tar.gz
dotty-bfa5e46d4cddd4b544c77bcef577c837fd403aad.tar.bz2
dotty-bfa5e46d4cddd4b544c77bcef577c837fd403aad.zip
Halfway to yet another scheme for handling positions
The previous attempt was very fragile, and did not play well with lazy trees, despite best intentions. It did not work correctly for normal trees, and it seemed anyeway very hard to extend this to annotations. The new scheme, as outlined in PicklerFormat, is simpler and naturally handles lazy trees and annotations.
Diffstat (limited to 'src/dotty/tools/dotc/core/pickling/PickleFormat.scala')
-rw-r--r--src/dotty/tools/dotc/core/pickling/PickleFormat.scala26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/PickleFormat.scala b/src/dotty/tools/dotc/core/pickling/PickleFormat.scala
index 9e864fc43..1c8555430 100644
--- a/src/dotty/tools/dotc/core/pickling/PickleFormat.scala
+++ b/src/dotty/tools/dotc/core/pickling/PickleFormat.scala
@@ -181,15 +181,21 @@ Note: Tree tags are grouped into 4 categories that determine what follows, and t
Category 3 (tags 100-127): tag Nat AST
Category 4 (tags 128-255): tag Length <payload>
-Standard Section: "Positions" Assoc*
-
- Assoc = offset_Delta addr_Delta // offsets and addresses determined by a tree traversal:
- // For each node with positions <start..end>
- // start <encoding of children> end
+Standard Section: "Positions" sourceLength_Nat Assoc*
+
+ Assoc = addr_Delta offset_Delta offset_Delta?
+ // addr_Delta :
+ // Difference of address to last recorded node. Always > 0
+ // (The initial base is -1, so a a first node of 0 would have a delta of 1).
+ // 2nd offset_Delta:
+ // Difference of end offset of addressed node vs parent node. Always <= 0
+ // 1st offset Delta, if delta >= 0 or 2nd offset delta exists
+ // Difference of start offset of addressed node vs parent node.
+ // 1st offset Delta, if delta < 0 and 2nd offset delta does not exist:
+ // Difference of end offset of addressed node vs parent node.
// Offsets and addresses are difference encoded.
- // Entries with same offset as previous entry are omitted.
+ // Nodes which have the same positions as their parents are omitted.
Delta = Int // Difference between consecutive offsets / tree addresses,
- // First offset/address is always assumed to be 0
**************************************************************************************/
@@ -330,9 +336,9 @@ object PickleFormat {
case VALDEF | DEFDEF | TYPEDEF | TYPEPARAM | PARAM => true
case _ => false
}
-
- def isParamTag(tag: Int) = tag == PARAM || tag == TYPEPARAM
-
+
+ def isParamTag(tag: Int) = tag == PARAM || tag == TYPEPARAM
+
def nameTagToString(tag: Int): String = tag match {
case UTF8 => "UTF8"
case QUALIFIED => "QUALIFIED"