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