Allow weird assignment syntax

Was: foo.(bar) -> foo. (bar)
Now the space is not added.
This commit is contained in:
Einar Lielmanis 2010-05-15 22:02:54 +03:00
parent ae4372ca90
commit 65b6eab52f
2 changed files with 3 additions and 2 deletions

View File

@ -631,8 +631,8 @@ function js_beautify(js_source_text, options) {
if (last_text === ';' || last_type === 'TK_START_BLOCK') {
print_newline();
} else if (last_type === 'TK_END_EXPR' || last_type === 'TK_START_EXPR' || last_type === 'TK_END_BLOCK') {
// do nothing on (( and )( and ][ and ]( ..
} else if (last_type === 'TK_END_EXPR' || last_type === 'TK_START_EXPR' || last_type === 'TK_END_BLOCK' || last_text == '.') {
// do nothing on (( and )( and ][ and ]( and .(
} else if (last_type !== 'TK_WORD' && last_type !== 'TK_OPERATOR') {
print_single_space();
} else if (last_word === 'function') {

View File

@ -282,6 +282,7 @@ function run_beautifier_tests(test_obj)
bt('var a = a,\n /* c */\n b;');
bt('var a = a,\n // c\n b;');
bt('foo.("bar");'); // weird element referencing
flags.space_after_anon_function = true;