Chromium Code Reviews| Index: Source/bindings/scripts/code_generator_v8.py |
| diff --git a/Source/bindings/scripts/code_generator_v8.py b/Source/bindings/scripts/code_generator_v8.py |
| index 37253ba582581d74d05b6cd002385d163791183d..97753cf56653b444cc43942faaee3713fd8e5670 100644 |
| --- a/Source/bindings/scripts/code_generator_v8.py |
| +++ b/Source/bindings/scripts/code_generator_v8.py |
| @@ -184,8 +184,16 @@ def runtime_enabled_if(code, runtime_enabled_function_name): |
| return code |
| # Indent if statement to level of original code |
| indent = re.match(' *', code).group(0) |
| - return ('%sif (%s())\n' % (indent, runtime_enabled_function_name) + |
| - ' %s' % code) |
| + lines = code.splitlines() |
| + if len(lines) > 1: |
|
Nils Barth (inactive)
2014/05/27 06:33:20
It's fine to always use a { } block, so you can el
|
| + fmt = '%(indent)sif (%(fnname)s()) {\n %(code)s\n%(indent)s}\n' |
|
Nils Barth (inactive)
2014/05/27 06:33:20
Could you use string concatenation and split the s
|
| + else: |
| + fmt = '%(indent)sif (%(fnname)s())\n %(code)s\n' |
| + return fmt % { |
|
Nils Barth (inactive)
2014/05/27 06:33:20
Could you use str.format instead of % with a dict?
|
| + 'indent': indent, |
| + 'fnname': runtime_enabled_function_name, |
| + 'code': '\n '.join(lines), |
| + } |
| ################################################################################ |