From ad20406f301e04075e051147092cf9c12a6a6ca8 Mon Sep 17 00:00:00 2001 From: ducky Date: Wed, 1 Feb 2017 14:19:15 -0800 Subject: Add macro for compile options materialize to prevent its use in chisel core --- chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'chiselFrontend') diff --git a/chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala b/chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala index 4aa3ad33..f512bf26 100644 --- a/chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala +++ b/chiselFrontend/src/main/scala/chisel3/core/CompileOptions.scala @@ -3,6 +3,7 @@ package chisel3.core import scala.language.experimental.macros +import scala.reflect.macros.blackbox.Context trait CompileOptions { // Should Record connections require a strict match of fields. @@ -26,7 +27,13 @@ trait CompileOptions { object CompileOptions { // Provides a low priority Strict default. Can be overridden by importing the NotStrict option. - implicit def materialize: CompileOptions = chisel3.core.ExplicitCompileOptions.Strict + // Implemented as a macro to prevent this from being used inside chisel core. + implicit def materialize: CompileOptions = macro materialize_impl + + def materialize_impl(c: Context): c.Tree = { + import c.universe._ + q"_root_.chisel3.core.ExplicitCompileOptions.Strict" + } } object ExplicitCompileOptions { -- cgit v1.2.3