-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Platform and runtime independent bindings must be able to targe…
- Loading branch information
1 parent
fcb054c
commit daf1380
Showing
8 changed files
with
95 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package fr.hammons.slinc.annotations | ||
|
||
import scala.annotation.StaticAnnotation | ||
import fr.hammons.slinc.fset.Dependency | ||
import scala.quoted.* | ||
|
||
final case class Needs(libName: String) | ||
extends StaticAnnotation, | ||
DependencyAnnotation: | ||
def toDependency: Dependency = Dependency.PathLibrary(libName) | ||
|
||
object Needs: | ||
inline def apply[F]: List[Needs] = ${ | ||
apply[F]() | ||
} | ||
|
||
def apply[F]()(using Quotes, Type[F]) = | ||
import quotes.reflect.* | ||
|
||
Expr.ofList( | ||
TypeRepr | ||
.of[F] | ||
.classSymbol | ||
.get | ||
.annotations | ||
.view | ||
.map(_.asExpr) | ||
.collect: | ||
case n @ '{ new Needs(${ _ }) } => n | ||
.toList | ||
) |
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