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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 'XSLT', | 53 'XSLT', |
54 ] | 54 ] |
55 | 55 |
56 | 56 |
57 ################################################################################ | 57 ################################################################################ |
58 # Extended attribute parsing | 58 # Extended attribute parsing |
59 ################################################################################ | 59 ################################################################################ |
60 | 60 |
61 def extended_attribute_value_contains(extended_attribute_value, value): | 61 def extended_attribute_value_contains(extended_attribute_value, value): |
62 return (extended_attribute_value and | 62 return (extended_attribute_value and |
63 value in re.split('[|&]', extended_attribute_value)) | 63 value in re.split('[|,]', extended_attribute_value)) |
64 | 64 |
65 | 65 |
66 def has_extended_attribute(definition_or_member, extended_attribute_list): | 66 def has_extended_attribute(definition_or_member, extended_attribute_list): |
67 return any(extended_attribute in definition_or_member.extended_attributes | 67 return any(extended_attribute in definition_or_member.extended_attributes |
68 for extended_attribute in extended_attribute_list) | 68 for extended_attribute in extended_attribute_list) |
69 | 69 |
70 | 70 |
71 def has_extended_attribute_value(definition_or_member, name, value): | 71 def has_extended_attribute_value(definition_or_member, name, value): |
72 extended_attributes = definition_or_member.extended_attributes | 72 extended_attributes = definition_or_member.extended_attributes |
73 return (name in extended_attributes and | 73 return (name in extended_attributes and |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 def call_with_arguments(call_with_values): | 197 def call_with_arguments(call_with_values): |
198 if not call_with_values: | 198 if not call_with_values: |
199 return [] | 199 return [] |
200 return [CALL_WITH_ARGUMENTS[value] | 200 return [CALL_WITH_ARGUMENTS[value] |
201 for value in CALL_WITH_VALUES | 201 for value in CALL_WITH_VALUES |
202 if extended_attribute_value_contains(call_with_values, value)] | 202 if extended_attribute_value_contains(call_with_values, value)] |
203 | 203 |
204 | 204 |
205 # [Conditional] | 205 # [Conditional] |
| 206 DELIMITER_TO_OPERATOR = { |
| 207 '|': '||', |
| 208 ',': '&&', |
| 209 } |
| 210 |
| 211 |
206 def conditional_string(definition_or_member): | 212 def conditional_string(definition_or_member): |
207 extended_attributes = definition_or_member.extended_attributes | 213 extended_attributes = definition_or_member.extended_attributes |
208 if 'Conditional' not in extended_attributes: | 214 if 'Conditional' not in extended_attributes: |
209 return None | 215 return None |
210 conditional = extended_attributes['Conditional'] | 216 conditional = extended_attributes['Conditional'] |
211 for operator in '&|': | 217 for delimiter in ',|': |
212 if operator in conditional: | 218 if delimiter in conditional: |
213 conditions = conditional.split(operator) | 219 conditions = conditional.split(delimiter) |
214 operator_separator = ' %s%s ' % (operator, operator) | 220 operator_separator = ' %s ' % DELIMITER_TO_OPERATOR[delimiter] |
215 return operator_separator.join('ENABLE(%s)' % expression for express
ion in sorted(conditions)) | 221 return operator_separator.join('ENABLE(%s)' % expression for express
ion in sorted(conditions)) |
216 return 'ENABLE(%s)' % conditional | 222 return 'ENABLE(%s)' % conditional |
217 | 223 |
218 | 224 |
219 # [DeprecateAs] | 225 # [DeprecateAs] |
220 def deprecate_as(member): | 226 def deprecate_as(member): |
221 extended_attributes = member.extended_attributes | 227 extended_attributes = member.extended_attributes |
222 if 'DeprecateAs' not in extended_attributes: | 228 if 'DeprecateAs' not in extended_attributes: |
223 return None | 229 return None |
224 includes.add('core/frame/UseCounter.h') | 230 includes.add('core/frame/UseCounter.h') |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 273 |
268 The returned function checks if a method/attribute is enabled. | 274 The returned function checks if a method/attribute is enabled. |
269 Given extended attribute RuntimeEnabled=FeatureName, return: | 275 Given extended attribute RuntimeEnabled=FeatureName, return: |
270 RuntimeEnabledFeatures::{featureName}Enabled | 276 RuntimeEnabledFeatures::{featureName}Enabled |
271 """ | 277 """ |
272 extended_attributes = definition_or_member.extended_attributes | 278 extended_attributes = definition_or_member.extended_attributes |
273 if 'RuntimeEnabled' not in extended_attributes: | 279 if 'RuntimeEnabled' not in extended_attributes: |
274 return None | 280 return None |
275 feature_name = extended_attributes['RuntimeEnabled'] | 281 feature_name = extended_attributes['RuntimeEnabled'] |
276 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) | 282 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) |
OLD | NEW |