From f36a1eaa8b5203ab7e4616108c33a0b68668a8db Mon Sep 17 00:00:00 2001 From: Mihai Bazon Date: Mon, 20 Oct 2014 18:12:13 +0300 Subject: Add option to allow return outside of functions. Close #288 --- lib/parse.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/parse.js b/lib/parse.js index de982b1e..931e5f66 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -609,6 +609,7 @@ function parse($TEXT, options) { toplevel : null, expression : false, html5_comments : true, + bare_returns : false, }); var S = { @@ -788,7 +789,7 @@ function parse($TEXT, options) { return if_(); case "return": - if (S.in_function == 0) + if (S.in_function == 0 && !options.bare_returns) croak("'return' outside of function"); return new AST_Return({ value: ( is("punc", ";") -- cgit v1.2.3