Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rewriting/wrapping a method's body using AST TypingTransformer traversal and quasiquotes in a Scala compiler plugin

License

NotificationsYou must be signed in to change notification settings

nenuadrian/scala-compiler-plugin-method-rewrite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains a Scala compiler plugin example that demonstrates basic annotation parsing, AST traversal, and method body replacement. It substitutes the block of a method (DefDef) with an inner method, allowing the original code to be wrapped and additional behavior injected.

https://medium.com/@adrian.n/scala-compiler-plugin-annotation-based-method-ast-rewriting-wrapping-substitution-b802f2d922f1

Overview

This plugin showcases:

  • Parsing annotations
  • Traversing the Abstract Syntax Tree (AST)
  • Replacing method bodies (DefDef)

The plugin rewrites annotated methods to include additional behaviour, such as logging or remote execution, without modifying the original method code.

About

Rewriting/wrapping a method's body using AST TypingTransformer traversal and quasiquotes in a Scala compiler plugin

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp