From 439e13875e6eb7c0d12761e347cd08f493ddf1a7 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Thu, 17 May 2018 13:07:39 -0700 Subject: [PATCH] Fixed a nil exception when an empty file gets parsed as s(:_unknown). Who knew? :shrug: --- lib/cc/engine/analyzers/javascript/main.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/cc/engine/analyzers/javascript/main.rb b/lib/cc/engine/analyzers/javascript/main.rb index 8f7f2d7d..05ae2d8a 100644 --- a/lib/cc/engine/analyzers/javascript/main.rb +++ b/lib/cc/engine/analyzers/javascript/main.rb @@ -36,6 +36,8 @@ def use_sexp_lines? # => s(:NUKE, s(:Program, :module, s(:NUKE, ... ))) def transform_sexp(sexp) + return sexp unless sexp.body + sexp.body.sexp_type = :NUKE # negate top level body sexp = s(:NUKE, sexp) # wrap with extra node to force full process