Scala macro that returns an empty AST -


itemprop = "text">

I have created a simple macro that generates compiler warnings (or errors) if specified date FIXME (or TODO)) Date

Macro implementation () used for Scala 2.10.4 c.Expr [Any] Return type, 2.11.0 is a whitebox macro that returns returns c.Tree .

Returning c.Expr [Any] (Amritree) or EmptyTree respectively returns a value. The following greetings of the macro believe,

  def hi () {FIXME ("2073/04/10: this has not been decided by 2073/04/10, then by canceling the collection Generates the following, println ("hello")}   

generates the following,

  def hi (): unit = {(& lt; blank & gt;: scala.runtime.BoxedUnit); Scala.this.Predef.println ("hi"}}; On the macro call site, it is possible to generate the following instead:  
  def hi (): unit = {scala.this.Predef.println ("hi")};    

You might consider making the block defined for the macro as an argument :

  def hi = FIXME ("...") {compare the println (...)} compiler with elidable code: it is a "zero" value, empty tree is not.  

You can also consider macro annotations.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -