| 1495 | level.push(-20); |
| 1496 | }, |
| 1497 | start = function beautify_script_level_start():void { |
| 1498 | const deep:string = data.stack[a + 1], |
| 1499 | deeper:string = (a === 0) |
| 1500 | ? data.stack[a] |
| 1501 | : data.stack[a - 1]; |
| 1502 | if (ltoke === ")" || ((deeper === "object" || deeper === "array") && ltoke !== "]")) { |
| 1503 | if (deep !== "method" || (deep === "method" && data.token[a + 1] !== ")" && data.token[a + 2] !== ")")) { |
| 1504 | if (ltoke === ")" && (deep !== "function" || data.token[data.begin[data.begin[a - 1] - 1]] === "(" || data.token[data.begin[data.begin[a - 1] - 1]] === "x(")) { |
| 1505 | destructfix(false, false); |
| 1506 | } else if (data.types[a + 1] !== "end" && data.types[a + 2] !== "end") { |
| 1507 | destructfix(true, false); |
| 1508 | } |
| 1509 | } |
| 1510 | } |
| 1511 | list.push(false); |
| 1512 | extraindent.push([]); |
| 1513 | assignlist.push(false); |
| 1514 | arrbreak.push(false); |
| 1515 | wordlist.push(false); |
| 1516 | itemcount.push(0); |
| 1517 | if (options.never_flatten === true || (deep === "array" && options.format_array === "indent") || options.language === "qml" || deep === "attribute" || ltype === "generic" || (deep === "class" && ltoke !== "(" && ltoke !== "x(") || (ctoke === "[" && data.token[a + 1] === "function")) { |
| 1518 | destruct.push(false); |
| 1519 | } else { |
| 1520 | if (deep === "expression" || deep === "method") { |
| 1521 | destruct.push(true); |
| 1522 | } else if ((deep === "object" || deep === "class") && (ltoke === "(" || ltoke === "x(" || ltype === "word" || ltype === "reference")) { |
| 1523 | //array or object literal following `return` or `(` |
| 1524 | destruct.push(true); |
| 1525 | } else if (deep === "array" || ctoke === "(" || ctoke === "x(") { |
| 1526 | //array, method, paren |
| 1527 | destruct.push(true); |
| 1528 | } else if (ctoke === "{" && deep === "object" && ltype !== "operator" && ltype !== "start" && ltype !== "string" && ltype !== "number" && deeper !== "object" && deeper !== "array" && a > 0) { |
| 1529 | //curly brace not in a list and not assigned |
| 1530 | destruct.push(true); |
| 1531 | } else { |
| 1532 | //not destructured (multiline) |
| 1533 | destruct.push(false); |
| 1534 | } |
| 1535 | } |
| 1536 | if (ctoke !== "(" && ctoke !== "x(" && data.stack[a + 1] !== "attribute") { |
| 1537 | indent = indent + 1; |
| 1538 | } |
| 1539 | if (ctoke === "{" || ctoke === "x{") { |
| 1540 | varindex.push(-1); |
| 1541 | if (data.types[a - 1] !== "comment") { |
| 1542 | if (ltype === "markup") { |
| 1543 | level[a - 1] = indent; |
| 1544 | } else if (options.braces === true && ltype !== "operator" && ltoke !== "return") { |
| 1545 | level[a - 1] = indent - 1; |
| 1546 | } else if (data.stack[a + 1] !== "block" && (deep === "function" || ltoke === ")" || ltoke === "x)" || ltoke === "," || ltoke === "}" || ltype === "markup")) { |
| 1547 | level[a - 1] = -10; |
| 1548 | } else if (ltoke === "{" || ltoke === "x{" || ltoke === "[" || ltoke === "}" || ltoke === "x}") { |
| 1549 | level[a - 1] = indent - 1; |
| 1550 | } |
| 1551 | } |
| 1552 | if (deep === "object") { |
| 1553 | if (options.format_object === "indent") { |
| 1554 | destruct[destruct.length - 1] = false; |