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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 IdlTypeBase.cpp_type_initializer = property(cpp_type_initializer) | 236 IdlTypeBase.cpp_type_initializer = property(cpp_type_initializer) |
237 IdlTypeBase.cpp_type_args = cpp_type | 237 IdlTypeBase.cpp_type_args = cpp_type |
238 IdlUnionType.cpp_type_initializer = '' | 238 IdlUnionType.cpp_type_initializer = '' |
239 | 239 |
240 | 240 |
241 IdlArrayOrSequenceType.native_array_element_type = property( | 241 IdlArrayOrSequenceType.native_array_element_type = property( |
242 lambda self: self.element_type) | 242 lambda self: self.element_type) |
243 | 243 |
244 | 244 |
245 def cpp_template_type(template, inner_type): | 245 def cpp_template_type(template, inner_type): |
246 """Returns C++ template specialized to type, with space added if needed.""" | 246 """Returns C++ template specialized to type.""" |
247 if inner_type.endswith('>'): | 247 format_string = '{template}<{inner_type}>' |
248 format_string = '{template}<{inner_type} >' | |
249 else: | |
250 format_string = '{template}<{inner_type}>' | |
251 return format_string.format(template=template, inner_type=inner_type) | 248 return format_string.format(template=template, inner_type=inner_type) |
252 | 249 |
253 | 250 |
254 def cpp_ptr_type(old_type, new_type, gc_type): | 251 def cpp_ptr_type(old_type, new_type, gc_type): |
255 if gc_type == 'GarbageCollectedObject': | 252 if gc_type == 'GarbageCollectedObject': |
256 return new_type | 253 return new_type |
257 if gc_type == 'WillBeGarbageCollectedObject': | 254 if gc_type == 'WillBeGarbageCollectedObject': |
258 if old_type == 'Vector': | 255 if old_type == 'Vector': |
259 return 'WillBe' + new_type | 256 return 'WillBe' + new_type |
260 return old_type + 'WillBe' + new_type | 257 return old_type + 'WillBe' + new_type |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 number_of_nullable_member_types_union) | 947 number_of_nullable_member_types_union) |
951 | 948 |
952 | 949 |
953 def includes_nullable_type_union(idl_type): | 950 def includes_nullable_type_union(idl_type): |
954 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 951 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
955 return idl_type.number_of_nullable_member_types == 1 | 952 return idl_type.number_of_nullable_member_types == 1 |
956 | 953 |
957 IdlTypeBase.includes_nullable_type = False | 954 IdlTypeBase.includes_nullable_type = False |
958 IdlNullableType.includes_nullable_type = True | 955 IdlNullableType.includes_nullable_type = True |
959 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 956 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
OLD | NEW |