Fixed array indentation regressions.

Was:

{
    [x()[x]];
indent;
}

Is:

{
    [x()[x]];
    indent;
}
This commit is contained in:
Einar Lielmanis 2009-09-18 15:07:46 +03:00
parent 516d388d4f
commit 80a63b7cfa
2 changed files with 13 additions and 1 deletions

View File

@ -214,6 +214,17 @@ function test_js_beautify()
bt('[[["1","2"],["3","4"]],[["5","6","7"],["8","9","0"]],[["1","2","3"],["4","5","6","7"],["8","9","0"]]]',
'[\n [\n ["1", "2"],\n ["3", "4"]],\n [\n ["5", "6", "7"],\n ["8", "9", "0"]],\n [\n ["1", "2", "3"],\n ["4", "5", "6", "7"],\n ["8", "9", "0"]]]');
bt('{[x()[0]];indent;}', '{\n [x()[0]];\n indent;\n}');
function foo(sQuery, oResponse, oPayload, o) {
if (oResponse.results.length < 10) {
for (var i = 0; i < test.ac.people1.length; i++) {
var uname = [test.ac.people1[i].split("\t")[0],
test.ac.people1[i].split("\t")[1]];
oResponse.results.push(uname);
}
}
}
space_after_anon_function = true;

View File

@ -486,8 +486,9 @@ function js_beautify(js_source_text, options)
if (token_text === '[') {
if (last_type === 'TK_WORD') {
if (last_type === 'TK_WORD' || last_text === ')') {
// this is array index specifier, break immediately
// a[x], fn()[x]
set_mode('(EXPRESSION)');
print_token();
break;