about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-10-29 22:22:16 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-10-29 22:22:16 +0100
commit3a58eb320e505b73572b4f59804f20b12e37a0a9 (patch)
treefe8a1142ba1e755f594567b5481d5fed029d0ef2
parent765649f4fb8796bb580c81dd64759d39cf5c226e (diff)
downloadnotyet-3a58eb320e505b73572b4f59804f20b12e37a0a9.tar.gz
notyet-3a58eb320e505b73572b4f59804f20b12e37a0a9.tar.xz
notyet-3a58eb320e505b73572b4f59804f20b12e37a0a9.zip
strip empty #splat
-rwxr-xr-xnotyet13
1 files changed, 8 insertions, 5 deletions
diff --git a/notyet b/notyet
index 62a72d4..925722d 100755
--- a/notyet
+++ b/notyet
@@ -90,10 +90,14 @@ class Entry < Struct.new(:depth, :state, :desc, :file, :line, :children)
     self.children = children.map { |c|
       c.splat
 
-      if c.desc == "#splat" && !c.children.empty?
-        sub = c.children.map { |cc| cc.children }.flatten
-        rel = sub.first.depth - c.depth
-        sub.map { |cc| cc.reindent(-rel) }
+      if c.desc == "#splat"
+        if c.children.empty?
+          []
+        else
+          sub = c.children.map { |cc| cc.children }.flatten
+          rel = sub.first.depth - c.depth
+          sub.map { |cc| cc.reindent(-rel) }
+        end
       else
         [c]
       end
@@ -143,7 +147,6 @@ def parse(io, filename=nil)
       children = []
 
       if desc =~ /^#exec\s+(.+)/
-# - error handling for #exec
         Dir.chdir(File.dirname(fname)) {
           begin
             IO.popen($1) { |f|