| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 # Make sure extension is .py, not .pyc or .pyo, so doesn't depend on caching | 65 # Make sure extension is .py, not .pyc or .pyo, so doesn't depend on caching |
| 66 MODULE_PYNAME = os.path.splitext(os.path.basename(__file__))[0] + '.py' | 66 MODULE_PYNAME = os.path.splitext(os.path.basename(__file__))[0] + '.py' |
| 67 | 67 |
| 68 def depending_union_type(idl_type): | 68 def depending_union_type(idl_type): |
| 69 """Returns the union type name if the given idl_type depends on a | 69 """Returns the union type name if the given idl_type depends on a |
| 70 union type. | 70 union type. |
| 71 """ | 71 """ |
| 72 def find_base_type(current_type): | 72 def find_base_type(current_type): |
| 73 if current_type.is_array_or_sequence_type: | 73 if current_type.is_array_or_sequence_type: |
| 74 return find_base_type(current_type.element_type) | 74 return find_base_type(current_type.element_type) |
| 75 if current_type.is_record_type: |
| 76 # IdlRecordType.key_type is always a string type, so we only need |
| 77 # to looking into value_type. |
| 78 return find_base_type(current_type.value_type) |
| 75 if current_type.is_nullable: | 79 if current_type.is_nullable: |
| 76 return find_base_type(current_type.inner_type) | 80 return find_base_type(current_type.inner_type) |
| 77 return current_type | 81 return current_type |
| 78 base_type = find_base_type(idl_type) | 82 base_type = find_base_type(idl_type) |
| 79 if base_type.is_union_type: | 83 if base_type.is_union_type: |
| 80 return base_type | 84 return base_type |
| 81 return None | 85 return None |
| 82 | 86 |
| 83 | 87 |
| 84 class TypedefResolver(Visitor): | 88 class TypedefResolver(Visitor): |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 outputs = set() | 385 outputs = set() |
| 382 for callback_function_dict in callback_functions.itervalues(): | 386 for callback_function_dict in callback_functions.itervalues(): |
| 383 if callback_function_dict['component_dir'] != self.target_component: | 387 if callback_function_dict['component_dir'] != self.target_component: |
| 384 continue | 388 continue |
| 385 callback_function = callback_function_dict['callback_function'] | 389 callback_function = callback_function_dict['callback_function'] |
| 386 if 'Custom' in callback_function.extended_attributes: | 390 if 'Custom' in callback_function.extended_attributes: |
| 387 continue | 391 continue |
| 388 path = callback_function_dict['full_path'] | 392 path = callback_function_dict['full_path'] |
| 389 outputs.update(self.generate_code_internal(callback_function, path)) | 393 outputs.update(self.generate_code_internal(callback_function, path)) |
| 390 return outputs | 394 return outputs |
| OLD | NEW |