Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor improvement for actionscript

  • Loading branch information...
commit 3f717d38a135175e49c11d855c3eed6a9c5ffe48 1 parent b1e925c
@einars einars authored
View
4 beautify.js
@@ -1152,7 +1152,9 @@ function js_beautify(js_source_text, options) {
} else if (token_text === ':') {
if (flags.ternary_depth == 0) {
- flags.mode = 'OBJECT';
+ if (flags.mode == 'BLOCK') {
+ flags.mode = 'OBJECT';
+ }
space_before = false;
} else {
flags.ternary_depth -= 1;
View
3  python/jsbeautifier/__init__.py
@@ -1034,7 +1034,8 @@ def handle_operator(self, token_text):
elif token_text == ':':
if self.flags.ternary_depth == 0:
- self.flags.mode = 'OBJECT'
+ if self.flags.mode == 'BLOCK':
+ self.flags.mode = 'OBJECT'
space_before = False
else:
self.flags.ternary_depth -= 1
View
1  python/jsbeautifier/tests/testjsbeautifier.py
@@ -428,6 +428,7 @@ def test_beautifier(self):
bt('3.*7;', '3. * 7;')
bt('import foo.*;', 'import foo.*;') # actionscript's import
+ test_fragment('function f(a: a, b: b)') # actionscript
def decodesto(self, input, expectation=None):
self.assertEqual(
View
1  tests/beautify-tests.js
@@ -482,6 +482,7 @@ function run_beautifier_tests(test_obj)
bt('3.*7;', '3. * 7;')
bt('import foo.*;', 'import foo.*;') // actionscript's import
+ test_fragment('function f(a: a, b: b)') // actionscript
return sanitytest;
}
Please sign in to comment.
Something went wrong with that request. Please try again.