diff options
author | Martin Odersky <odersky@gmail.com> | 2016-05-21 19:11:15 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-05-23 12:01:40 +0200 |
commit | 7f08c1fbd674d6ebf3f74e75fe5b3e83daf9da7e (patch) | |
tree | c88c5dfa6935bf7f9d64e6e8c4fd160f65881c39 /src/dotty/tools/dotc/core/tasty/TastyFormat.scala | |
parent | 1f8cf78441d84385734a210b0a5971eae76f46fc (diff) | |
download | dotty-7f08c1fbd674d6ebf3f74e75fe5b3e83daf9da7e.tar.gz dotty-7f08c1fbd674d6ebf3f74e75fe5b3e83daf9da7e.tar.bz2 dotty-7f08c1fbd674d6ebf3f74e75fe5b3e83daf9da7e.zip |
Maintain ownerTree data structure when unpickling Tasty
First step for a more robust scheme to access symbols in Tasty.
This entailed a swap of two fields in RefiendType, to make tree
format more uniform in what concerns where references are found.
Diffstat (limited to 'src/dotty/tools/dotc/core/tasty/TastyFormat.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/tasty/TastyFormat.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/tasty/TastyFormat.scala b/src/dotty/tools/dotc/core/tasty/TastyFormat.scala index ea7e985c9..221170622 100644 --- a/src/dotty/tools/dotc/core/tasty/TastyFormat.scala +++ b/src/dotty/tools/dotc/core/tasty/TastyFormat.scala @@ -485,4 +485,15 @@ object TastyFormat { case PRIVATEqualified => "PRIVATEqualified" case PROTECTEDqualified => "PROTECTEDqualified" } + + /** @return If non-negative, the number of leading references of a length/trees entry. + * If negative, minus the number of leading non-reference trees. + */ + def numRefs(tag: Int) = tag match { + case VALDEF | DEFDEF | TYPEDEF | TYPEPARAM | PARAM | NAMEDARG | RETURN | BIND | + SELFDEF | REFINEDtype => 1 + case RENAMED | PARAMtype => 2 + case POLYtype | METHODtype => -1 + case _ => 0 + } } |