From efc0e0a80e09fbf15e233cb7424f2887aa03bab1 Mon Sep 17 00:00:00 2001
From: Manos Koukoutos <emmanouil.koukoutos@epfl.ch>
Date: Thu, 9 Jul 2015 16:21:48 +0200
Subject: [PATCH] CodeExtraction should exclude empty trees

---
 .../leon/frontends/scalac/CodeExtraction.scala     | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/main/scala/leon/frontends/scalac/CodeExtraction.scala b/src/main/scala/leon/frontends/scalac/CodeExtraction.scala
index 8970b698a..dae5018a0 100644
--- a/src/main/scala/leon/frontends/scalac/CodeExtraction.scala
+++ b/src/main/scala/leon/frontends/scalac/CodeExtraction.scala
@@ -215,7 +215,7 @@ trait CodeExtraction extends ASTExtractors {
 
     private def collectClassSymbols(defs: List[Tree]) {
       // We collect all defined classes
-      for (t <- defs) t match {
+      for (t <- defs if !t.isEmpty) t match {
         case t if isIgnored(t.symbol) =>
           // ignore
 
@@ -226,7 +226,7 @@ trait CodeExtraction extends ASTExtractors {
           seenClasses += sym -> ((args, tmpl))
 
         case ExObjectDef(n, templ) =>
-          for (t <- templ.body) t match {
+          for (t <- templ.body if !t.isEmpty) t match {
             case t if isIgnored(t.symbol) =>
               // ignore
 
@@ -320,28 +320,28 @@ trait CodeExtraction extends ASTExtractors {
           // ignore
 
         case ExAbstractClass(_, sym, tpl) =>
-          for (t <- tpl.body) {
+          for (t <- tpl.body if !t.isEmpty) {
             extractFunOrMethodBody(Some(sym), t)
           }
 
         case ExCaseClass(_, sym, _, tpl) =>
-          for (t <- tpl.body) {
+          for (t <- tpl.body if !t.isEmpty) {
             extractFunOrMethodBody(Some(sym), t)
           }
 
         case ExObjectDef(n, templ) =>
-          for (t <- templ.body) t match {
+          for (t <- templ.body if !t.isEmpty) t match {
             case t if isIgnored(t.symbol) =>
               // ignore
               None
 
             case ExAbstractClass(_, sym, tpl) =>
-              for (t <- tpl.body) {
+              for (t <- tpl.body if !t.isEmpty) {
                 extractFunOrMethodBody(Some(sym), t)
               }
 
             case ExCaseClass(_, sym, _, tpl) =>
-              for (t <- tpl.body) {
+              for (t <- tpl.body if !t.isEmpty) {
                 extractFunOrMethodBody(Some(sym), t)
               }
 
-- 
GitLab