-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from tindzk/issue/16
Fix inheritance of compiler plug-ins
- Loading branch information
Showing
12 changed files
with
274 additions
and
30 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
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,26 @@ | ||
# See https://github.com/tindzk/seed/issues/16 | ||
[project] | ||
scalaVersion = "2.11.12" | ||
scalaJsVersion = "0.6.26" | ||
scalaOptions = ["-encoding", "UTF-8", "-unchecked", "-deprecation", "-Xfuture"] | ||
|
||
[module.macros] | ||
root = "macros" | ||
sources = ["macros"] | ||
targets = ["jvm", "js"] | ||
|
||
[module.macros.jvm] | ||
compilerDeps = [ | ||
["org.scalamacros", "paradise", "2.1.1", "full"] | ||
] | ||
|
||
[module.macros.js] | ||
compilerDeps = [ | ||
["org.scalamacros", "paradise", "2.1.1", "full"] | ||
] | ||
|
||
[module.example] | ||
root = "example" | ||
sources = ["example"] | ||
targets = ["jvm", "js"] | ||
moduleDeps = ["macros"] |
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,4 @@ | ||
@hello | ||
object Test extends App { | ||
println(this.hello) | ||
} |
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,26 @@ | ||
import scala.reflect.macros.blackbox | ||
import scala.language.experimental.macros | ||
import scala.annotation.StaticAnnotation | ||
|
||
object helloMacro { | ||
def impl(c: blackbox.Context)(annottees: c.Expr[Any]*): c.Expr[Any] = { | ||
import c.universe._ | ||
import Flag._ | ||
val result = { | ||
annottees.map(_.tree).toList match { | ||
case q"object $name extends ..$parents { ..$body }" :: Nil => | ||
q""" | ||
object $name extends ..$parents { | ||
def hello: ${typeOf[String]} = "hello" | ||
..$body | ||
} | ||
""" | ||
} | ||
} | ||
c.Expr[Any](result) | ||
} | ||
} | ||
|
||
class hello extends StaticAnnotation { | ||
def macroTransform(annottees: Any*): Any = macro helloMacro.impl | ||
} |
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,23 @@ | ||
[project] | ||
scalaVersion = "2.11.12" | ||
scalaJsVersion = "0.6.26" | ||
scalaOptions = ["-encoding", "UTF-8", "-unchecked", "-deprecation", "-Xfuture"] | ||
|
||
[module.macros] | ||
root = "macros" | ||
sources = ["macros"] | ||
targets = ["jvm", "js"] | ||
compilerDeps = [ | ||
["org.scalamacros", "paradise", "2.1.0", "full"] | ||
] | ||
|
||
[module.macros.js] | ||
compilerDeps = [ | ||
["org.scalamacros", "paradise", "2.1.1", "full"] | ||
] | ||
|
||
[module.example] | ||
root = "example" | ||
sources = ["example"] | ||
targets = ["jvm", "js"] | ||
moduleDeps = ["macros"] |
Oops, something went wrong.