File tree Expand file tree Collapse file tree 3 files changed +9
-42
lines changed
library/src/scala/tasty/util Expand file tree Collapse file tree 3 files changed +9
-42
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -45,11 +45,9 @@ object Macros {
45
45
}
46
46
47
47
def power (n : Expr [Int ], x : Expr [Double ])(implicit reflect : Reflection ): Expr [Double ] = {
48
- import reflect ._
49
-
50
- val Constant = new ConstantExtractor (reflect)
48
+ import quoted .matching .Literal
51
49
n match {
52
- case Constant (n1) => powerCode(n1, x)
50
+ case Literal (n1) => powerCode(n1, x)
53
51
case _ => ' { dynamicPower($n, $x) }
54
52
}
55
53
}
Original file line number Diff line number Diff line change 1
1
import scala .quoted ._
2
2
import scala .quoted .autolift ._
3
3
4
+ import scala .quoted .matching ._
5
+
4
6
import scala .tasty ._
5
7
import scala .tasty .util ._
6
8
@@ -9,19 +11,16 @@ object Macros {
9
11
implicit inline def testMacro : Unit = $ {impl}
10
12
11
13
def impl (implicit reflect : Reflection ): Expr [Unit ] = {
12
- import reflect ._
13
14
14
15
val buff = new StringBuilder
15
16
def stagedPrintln (x : Any ): Unit = buff append java.util.Objects .toString(x) append " \n "
16
17
17
- val Constant = new ConstantExtractor (reflect)
18
-
19
- 3 .toExpr match { case Constant (n) => stagedPrintln(n) }
20
- ' {4 } match { case Constant (n) => stagedPrintln(n) }
21
- ' {" abc" } match { case Constant (n) => stagedPrintln(n) }
22
- ' {null } match { case Constant (n) => stagedPrintln(n) }
18
+ 3 .toExpr match { case Literal (n) => stagedPrintln(n) }
19
+ ' {4 } match { case Literal (n) => stagedPrintln(n) }
20
+ ' {" abc" } match { case Literal (n) => stagedPrintln(n) }
21
+ ' {null } match { case Literal (n) => stagedPrintln(n) }
23
22
24
- ' {new Object } match { case Constant (n) => println(n); case _ => stagedPrintln(" OK" ) }
23
+ ' {new Object } match { case Literal (n) => println(n); case _ => stagedPrintln(" OK" ) }
25
24
26
25
' {print($ {buff.result()})}
27
26
}
You can’t perform that action at this time.
0 commit comments