| 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 24 matching lines...) Expand all Loading... |
| 35 For details, see bug http://crbug.com/239771 | 35 For details, see bug http://crbug.com/239771 |
| 36 """ | 36 """ |
| 37 | 37 |
| 38 # FIXME: eliminate this file if possible | 38 # FIXME: eliminate this file if possible |
| 39 | 39 |
| 40 import v8_types | 40 import v8_types |
| 41 | 41 |
| 42 ACRONYMS = ['CSS', 'HTML', 'IME', 'JS', 'SVG', 'URL', 'WOFF', 'XML', 'XSLT'] | 42 ACRONYMS = ['CSS', 'HTML', 'IME', 'JS', 'SVG', 'URL', 'WOFF', 'XML', 'XSLT'] |
| 43 | 43 |
| 44 | 44 |
| 45 # FIXME: these could be merged as implemented_as_cpp_name | 45 def cpp_implemented_as_name(definition_or_member): |
| 46 def cpp_class_name(interface): | 46 return definition_or_member.extended_attributes.get('ImplementedAs', definit
ion_or_member.name) |
| 47 return interface.extended_attributes.get('ImplementedAs', interface.name) | |
| 48 | 47 |
| 49 | 48 |
| 50 def cpp_method_name(attribute_or_operation): | 49 def generate_conditional_string(definition_or_member): |
| 51 return attribute_or_operation.extended_attributes.get('ImplementedAs', attri
bute_or_operation.name) | 50 if 'Conditional' not in definition_or_member.extended_attributes: |
| 52 | |
| 53 | |
| 54 def generate_conditional_string(interface_or_attribute_or_operation): | |
| 55 if 'Conditional' not in interface_or_attribute_or_operation.extended_attribu
tes: | |
| 56 return '' | 51 return '' |
| 57 conditional = interface_or_attribute_or_operation.extended_attributes['Condi
tional'] | 52 conditional = definition_or_member.extended_attributes['Conditional'] |
| 58 for operator in ['&', '|']: | 53 for operator in ['&', '|']: |
| 59 if operator in conditional: | 54 if operator in conditional: |
| 60 conditions = set(conditional.split(operator)) | 55 conditions = set(conditional.split(operator)) |
| 61 operator_separator = ' %s%s ' % (operator, operator) | 56 operator_separator = ' %s%s ' % (operator, operator) |
| 62 return operator_separator.join(['ENABLE(%s)' % expression for expres
sion in sorted(conditions)]) | 57 return operator_separator.join(['ENABLE(%s)' % expression for expres
sion in sorted(conditions)]) |
| 63 return 'ENABLE(%s)' % conditional | 58 return 'ENABLE(%s)' % conditional |
| 64 | 59 |
| 65 | 60 |
| 66 def runtime_enable_function_name(definition_or_member): | 61 def runtime_enable_function_name(definition_or_member): |
| 67 """Return the name of the RuntimeEnabledFeatures function. | 62 """Return the name of the RuntimeEnabledFeatures function. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 83 """ | 78 """ |
| 84 for acronym in ACRONYMS: | 79 for acronym in ACRONYMS: |
| 85 if name.startswith(acronym): | 80 if name.startswith(acronym): |
| 86 name.replace(acronym, acronym.lower()) | 81 name.replace(acronym, acronym.lower()) |
| 87 return name | 82 return name |
| 88 return name[0].lower() + name[1:] | 83 return name[0].lower() + name[1:] |
| 89 | 84 |
| 90 | 85 |
| 91 def v8_class_name(interface): | 86 def v8_class_name(interface): |
| 92 return v8_types.v8_type(interface.name) | 87 return v8_types.v8_type(interface.name) |
| OLD | NEW |