diff options
| author | ducky | 2017-02-01 16:07:09 -0800 |
|---|---|---|
| committer | Richard Lin | 2017-02-07 16:24:17 -0800 |
| commit | 8d2fff4eff3ba0f92437b290985b35afbb0ed565 (patch) | |
| tree | 97b3f62d73c61ceb12ccb6bd684e63df5be8ed0d /coreMacros/src/main | |
| parent | ad20406f301e04075e051147092cf9c12a6a6ca8 (diff) | |
Name all the things
Diffstat (limited to 'coreMacros/src/main')
| -rw-r--r-- | coreMacros/src/main/scala/chisel3/internal/sourceinfo/NamingAnnotations.scala | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/coreMacros/src/main/scala/chisel3/internal/sourceinfo/NamingAnnotations.scala b/coreMacros/src/main/scala/chisel3/internal/sourceinfo/NamingAnnotations.scala index 1f7c1cac..952e9f91 100644 --- a/coreMacros/src/main/scala/chisel3/internal/sourceinfo/NamingAnnotations.scala +++ b/coreMacros/src/main/scala/chisel3/internal/sourceinfo/NamingAnnotations.scala @@ -82,9 +82,12 @@ class NamingTransforms(val c: Context) { tree // don't recurse into inner classes case q"$mods def $tname[..$tparams](...$paramss): $tpt = $expr" => { val Modifiers(_, _, annotations) = mods + // don't apply naming transform twice val containsChiselName = annotations.map({q"new chiselName()" equalsStructure _}).fold(false)({_||_}) - if (containsChiselName) { - tree // don't apply the transform multiple times + // transforming overloaded initializers causes errors, and the transform isn't helpful + val isInitializer = tname == TermName("<init>") + if (containsChiselName || isInitializer) { + tree } else { // apply chiselName transform by default val transformedExpr = transformHierarchicalMethod(expr) @@ -178,3 +181,16 @@ class NamingTransforms(val c: Context) { q"..$transformed" } } + +@compileTimeOnly("enable macro paradise to expand macro annotations") +class dump extends StaticAnnotation { + def macroTransform(annottees: Any*): Any = macro chisel3.internal.naming.DebugTransforms.dump +} +@compileTimeOnly("enable macro paradise to expand macro annotations") +class treedump extends StaticAnnotation { + def macroTransform(annottees: Any*): Any = macro chisel3.internal.naming.DebugTransforms.treedump +} +@compileTimeOnly("enable macro paradise to expand macro annotations") +class chiselName extends StaticAnnotation { + def macroTransform(annottees: Any*): Any = macro chisel3.internal.naming.NamingTransforms.chiselName +} |
