From a342e6b9014362ef62ced898838efaa99da9400f Mon Sep 17 00:00:00 2001 From: "shani.elh" Date: Tue, 8 Mar 2016 16:09:31 +0200 Subject: [PATCH] Allow extending user defined traits by adding option 'trait' to messages --- .../main/net/sandrogrzicic/scalabuff/compiler/Generator.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scalabuff-compiler/src/main/net/sandrogrzicic/scalabuff/compiler/Generator.scala b/scalabuff-compiler/src/main/net/sandrogrzicic/scalabuff/compiler/Generator.scala index bf97060..6f7d65e 100644 --- a/scalabuff-compiler/src/main/net/sandrogrzicic/scalabuff/compiler/Generator.scala +++ b/scalabuff-compiler/src/main/net/sandrogrzicic/scalabuff/compiler/Generator.scala @@ -149,6 +149,10 @@ class Generator protected (sourceName: String, importedSymbols: Map[String, Impo } out.append('\n').append(indent1).append("with net.sandrogrzicic.scalabuff.Parser[").append(name).append("]") + for (OptionValue(_, value) <- body.options.filter(_.key == "trait")) { + out.append('\n').append(indent1).append("with ").append(value.replace("$name", name).stripQuotes) + } + out.append(" {\n\n") // setters