8000 Printer improvements to fuse JS emitting and printing by gzm0 · Pull Request #4920 · scala-js/scala-js · GitHub
[go: up one dir, main page]

Skip to content

Printer improvements to fuse JS emitting and printing #4920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Do not print skip's in blocks
  • Loading branch information
gzm0 committed Jan 28, 2024
commit 197af9a726414fc68345920fadc5bd77c419f0fd
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,21 @@ object Printers {
}

protected def printBlock(tree: Tree): Unit = {
print('{'); indent(); println()
print('{'); indent();
tree match {
case Skip() =>
// do not print anything

case tree: Block =>
var rest = tree.stats
while (rest.nonEmpty) {
val x = rest.head
println()
printStat(rest.head)
rest = rest.tail
printStat(x)
if (rest.nonEmpty)
println()
}

case _ =>
println()
printStat(tree)
}
undent(); println(); print('}')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class LibrarySizeTest {
)

testLinkedSizes(
expectedFastLinkSize = 150534,
expectedFullLinkSizeWithoutClosure = 131079,
expectedFastLinkSize = 150339,
expectedFullLinkSizeWithoutClosure = 130884,
expectedFullLinkSizeWithClosure = 21394,
classDefs,
moduleInitializers = MainTestModuleInitializers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class PrintersTest {
assertPrintEquals(
"""
|function test() {
| /*<skip>*/
|}
""",
FunctionDef("test", Nil, None, Skip())
Expand All @@ -74,13 +73,11 @@ class PrintersTest {
"""
|class MyClass {
| foo() {
| /*<skip>*/
| }
| get a() {
| return 1;
| }
| set a(x) {
| /*<skip>*/
| }
|}
""",
Expand All @@ -105,7 +102,6 @@ class PrintersTest {
assertPrintEquals(
"""
|for (let x = 1; (x < 15); x = (x + 1)) {
| /*<skip>*/
|}
""",
For(Let("x", true, Some(IntLiteral(1))),
Expand All @@ -119,7 +115,6 @@ class PrintersTest {
assertPrintEquals(
"""
|for (var x in foo) {
| /*<skip>*/
|}
""",
ForIn(VarDef("x", None), VarRef("foo"), Skip())
Expand Down
6 changes: 3 additions & 3 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1967,15 +1967,15 @@ object Build {
scalaVersion.value match {
case `default212Version` =>
Some(ExpectedSizes(
fastLink = 775000 to 776000,
fastLink = 770000 to 771000,
fullLink = 145000 to 146000,
fastLinkGz = 91000 to 92000,
fastLinkGz = 90000 to 91000,
fullLinkGz = 35000 to 36000,
))

case `default213Version` =>
Some(ExpectedSizes(
fastLink = 481000 to 483000,
fastLink = 479000 to 480000,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised not to see changes in LibrarySizeTest. Weren't there any /*<skip>*/ there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were within tolerance, but I have adjusted / tightened them.

fullLink = 102000 to 103000,
fastLinkGz = 62000 to 63000,
fullLinkGz = 27000 to 28000,
Expand Down
0