Skip to content

Commit

Permalink
Improved DebugAST, can print Any
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmith00000 committed Dec 17, 2024
1 parent 4280e0e commit 33bcf8f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ultraviolet/shared/src/test/scala/ultraviolet/DebugAST.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,20 @@ object DebugAST:

import quotes.reflect.*

println(">>> Everything")
println(">>> AST (Shader[In, Out]):")
println(Printer.TreeStructure.show(expr.asTerm))
println("<<<")

Expr("Done.")
}

inline def any[In, Out](inline expr: Any): String = ${ anyToASTImpl('{ expr }) }

private def anyToASTImpl[In, Out: Type](expr: Expr[Any])(using Quotes): Expr[String] = {

import quotes.reflect.*

println(">>> AST (Any):")
println(Printer.TreeStructure.show(expr.asTerm))
println("<<<")

Expand Down

0 comments on commit 33bcf8f

Please sign in to comment.