| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 import jinja2 | 73 import jinja2 |
| 74 | 74 |
| 75 from idl_definitions import Visitor | 75 from idl_definitions import Visitor |
| 76 import idl_types | 76 import idl_types |
| 77 from idl_types import IdlType | 77 from idl_types import IdlType |
| 78 from v8_attributes import attribute_filters | 78 from v8_attributes import attribute_filters |
| 79 import v8_callback_interface | 79 import v8_callback_interface |
| 80 import v8_dictionary | 80 import v8_dictionary |
| 81 from v8_globals import includes, interfaces | 81 from v8_globals import includes, interfaces |
| 82 import v8_interface | 82 import v8_interface |
| 83 from v8_methods import method_filters |
| 83 import v8_types | 84 import v8_types |
| 84 import v8_union | 85 import v8_union |
| 85 from v8_utilities import capitalize, cpp_name, for_origin_trial_feature, unique_
by | 86 from v8_utilities import capitalize, cpp_name, for_origin_trial_feature, unique_
by |
| 86 from utilities import idl_filename_to_component, is_valid_component_dependency,
is_testing_target, shorten_union_name | 87 from utilities import idl_filename_to_component, is_valid_component_dependency,
is_testing_target, shorten_union_name |
| 87 | 88 |
| 88 | 89 |
| 89 def normalize_and_sort_includes(include_paths): | 90 def normalize_and_sort_includes(include_paths): |
| 90 normalized_include_paths = [] | 91 normalized_include_paths = [] |
| 91 for include_path in include_paths: | 92 for include_path in include_paths: |
| 92 match = re.search(r'/gen/blink/(.*)$', posixpath.abspath(include_path)) | 93 match = re.search(r'/gen/blink/(.*)$', posixpath.abspath(include_path)) |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 trim_blocks=True) | 425 trim_blocks=True) |
| 425 jinja_env.filters.update({ | 426 jinja_env.filters.update({ |
| 426 'blink_capitalize': capitalize, | 427 'blink_capitalize': capitalize, |
| 427 'exposed': exposed_if, | 428 'exposed': exposed_if, |
| 428 'for_origin_trial_feature': for_origin_trial_feature, | 429 'for_origin_trial_feature': for_origin_trial_feature, |
| 429 'runtime_enabled': runtime_enabled_if, | 430 'runtime_enabled': runtime_enabled_if, |
| 430 'unique_by': unique_by, | 431 'unique_by': unique_by, |
| 431 }) | 432 }) |
| 432 jinja_env.filters.update(attribute_filters()) | 433 jinja_env.filters.update(attribute_filters()) |
| 433 jinja_env.filters.update(v8_interface.constant_filters()) | 434 jinja_env.filters.update(v8_interface.constant_filters()) |
| 435 jinja_env.filters.update(method_filters()) |
| 434 return jinja_env | 436 return jinja_env |
| 435 | 437 |
| 436 | 438 |
| 437 def generate_indented_conditional(code, conditional): | 439 def generate_indented_conditional(code, conditional): |
| 438 # Indent if statement to level of original code | 440 # Indent if statement to level of original code |
| 439 indent = re.match(' *', code).group(0) | 441 indent = re.match(' *', code).group(0) |
| 440 return ('%sif (%s) {\n' % (indent, conditional) + | 442 return ('%sif (%s) {\n' % (indent, conditional) + |
| 441 ' %s\n' % '\n '.join(code.splitlines()) + | 443 ' %s\n' % '\n '.join(code.splitlines()) + |
| 442 '%s}\n' % indent) | 444 '%s}\n' % indent) |
| 443 | 445 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 479 |
| 478 # Create a dummy file as output for the build system, | 480 # Create a dummy file as output for the build system, |
| 479 # since filenames of individual cache files are unpredictable and opaque | 481 # since filenames of individual cache files are unpredictable and opaque |
| 480 # (they are hashes of the template path, which varies based on environment) | 482 # (they are hashes of the template path, which varies based on environment) |
| 481 with open(dummy_filename, 'w') as dummy_file: | 483 with open(dummy_filename, 'w') as dummy_file: |
| 482 pass # |open| creates or touches the file | 484 pass # |open| creates or touches the file |
| 483 | 485 |
| 484 | 486 |
| 485 if __name__ == '__main__': | 487 if __name__ == '__main__': |
| 486 sys.exit(main(sys.argv)) | 488 sys.exit(main(sys.argv)) |
| OLD | NEW |