emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master e4ee2ec 042/271: Catch parse errors.


From: Jackson Ray Hamilton
Subject: [elpa] master e4ee2ec 042/271: Catch parse errors.
Date: Thu, 05 Feb 2015 18:29:38 +0000

branch: master
commit e4ee2ecfef6e6c18ed7039319ea5e6be6b893b4b
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>

    Catch parse errors.
---
 scopifier.js |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/scopifier.js b/scopifier.js
index 9605293..263fb54 100644
--- a/scopifier.js
+++ b/scopifier.js
@@ -17,7 +17,6 @@ process.stdin.on('readable', function () {
 process.stdin.on('end', function () {
     var scopes = [],
         symbols = [],
-        toplevel = UglifyJS.parse(whole),
         walker = new UglifyJS.TreeWalker(function (node) {
             if (node instanceof UglifyJS.AST_Scope) {
                 if (node.level === undefined) {
@@ -35,8 +34,16 @@ process.stdin.on('end', function () {
                               node.start.pos + 1,
                               node.end.endpos + 1]);
             }
-        });
-    toplevel.figure_out_scope();
-    toplevel.walk(walker);
+        }),
+        toplevel;
+
+    try {
+        toplevel = UglifyJS.parse(whole);
+        toplevel.figure_out_scope();
+        toplevel.walk(walker);
+    } catch (error) {
+        process.exit(1);
+    }
+
     console.log(JSON.stringify(scopes.concat(symbols)));
 });



reply via email to

[Prev in Thread] Current Thread [Next in Thread]