-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store source file in TASTY attributes
- Loading branch information
1 parent
052bce4
commit 028219c
Showing
14 changed files
with
118 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
package dotty.tools.dotc.core.tasty | ||
|
||
import dotty.tools.tasty.TastyFormat | ||
|
||
class Attributes( | ||
val scala2StandardLibrary: Boolean, | ||
val explicitNulls: Boolean, | ||
) | ||
val booleanTags: List[Int], | ||
val stringTagValues: List[(Int, String)], | ||
) { | ||
def scala2StandardLibrary: Boolean = | ||
booleanTags.contains(TastyFormat.SCALA2STANDARDLIBRARYattr) | ||
def explicitNulls: Boolean = | ||
booleanTags.contains(TastyFormat.EXPLICITNULLSattr) | ||
def sourceFile: Option[String] = | ||
stringTagValues.find(_._1 == TastyFormat.SOURCEFILEattr).map(_._2) | ||
} | ||
|
||
object Attributes: | ||
def apply( | ||
sourceFile: String, | ||
scala2StandardLibrary: Boolean, | ||
explicitNulls: Boolean, | ||
): Attributes = | ||
val booleanTags = List.newBuilder[Int] | ||
if scala2StandardLibrary then booleanTags += TastyFormat.SCALA2STANDARDLIBRARYattr | ||
if explicitNulls then booleanTags += TastyFormat.EXPLICITNULLSattr | ||
|
||
val stringTagValues = List( | ||
(TastyFormat.SOURCEFILEattr, sourceFile) | ||
) | ||
|
||
new Attributes(booleanTags.result(), stringTagValues) | ||
end apply |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters