Merge 86df7d95ff into fcde6109b0
This commit is contained in:
commit
8a4e6d8c38
|
|
@ -61,6 +61,7 @@ function OutputStream(options) {
|
|||
semicolons : true,
|
||||
comments : false,
|
||||
preserve_line : false,
|
||||
no_empty_line : false,
|
||||
screw_ie8 : false,
|
||||
preamble : null,
|
||||
quote_style : 0
|
||||
|
|
@ -70,6 +71,7 @@ function OutputStream(options) {
|
|||
var current_col = 0;
|
||||
var current_line = 1;
|
||||
var current_pos = 0;
|
||||
var current_line_offset = 0;
|
||||
var OUTPUT = "";
|
||||
|
||||
function to_ascii(str, identifier) {
|
||||
|
|
@ -168,7 +170,9 @@ function OutputStream(options) {
|
|||
OUTPUT += ";";
|
||||
current_col++;
|
||||
current_pos++;
|
||||
} else {
|
||||
} else if (!options.preserve_line ||
|
||||
OUTPUT.substr(-6) !== "return")
|
||||
{
|
||||
OUTPUT += "\n";
|
||||
current_pos++;
|
||||
current_line++;
|
||||
|
|
@ -188,12 +192,20 @@ function OutputStream(options) {
|
|||
|
||||
if (!options.beautify && options.preserve_line && stack[stack.length - 1]) {
|
||||
var target_line = stack[stack.length - 1].start.line;
|
||||
while (current_line < target_line) {
|
||||
while (current_line + current_line_offset < target_line) {
|
||||
if (OUTPUT.substr(-6) === "return")
|
||||
break;
|
||||
|
||||
OUTPUT += "\n";
|
||||
current_pos++;
|
||||
current_line++;
|
||||
current_col = 0;
|
||||
might_need_space = false;
|
||||
|
||||
if (options.no_empty_line) {
|
||||
current_line_offset = target_line - current_line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user