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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 return ('PassRefPtr<%s>' if used_as_rvalue_type else 'RefPtr<%s>') % bas
e_idl_type | 178 return ('PassRefPtr<%s>' if used_as_rvalue_type else 'RefPtr<%s>') % bas
e_idl_type |
179 if idl_type.is_string_type: | 179 if idl_type.is_string_type: |
180 if not raw_type: | 180 if not raw_type: |
181 return 'String' | 181 return 'String' |
182 return 'V8StringResource<%s>' % string_mode() | 182 return 'V8StringResource<%s>' % string_mode() |
183 | 183 |
184 if idl_type.is_array_buffer_or_view and raw_type: | 184 if idl_type.is_array_buffer_or_view and raw_type: |
185 return idl_type.implemented_as + '*' | 185 return idl_type.implemented_as + '*' |
186 if idl_type.is_interface_type: | 186 if idl_type.is_interface_type: |
187 implemented_as_class = idl_type.implemented_as | 187 implemented_as_class = idl_type.implemented_as |
188 if raw_type: | 188 if raw_type or (used_as_rvalue_type and idl_type.is_garbage_collected): |
189 return implemented_as_class + '*' | 189 return implemented_as_class + '*' |
190 new_type = 'Member' if used_in_cpp_sequence else 'RawPtr' | 190 new_type = 'Member' if used_in_cpp_sequence else 'RawPtr' |
191 ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_rvalue_type else 'RefPt
r'), new_type, idl_type.gc_type) | 191 ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_rvalue_type else 'RefPt
r'), new_type, idl_type.gc_type) |
192 return cpp_template_type(ptr_type, implemented_as_class) | 192 return cpp_template_type(ptr_type, implemented_as_class) |
193 if idl_type.is_dictionary: | 193 if idl_type.is_dictionary: |
194 return base_idl_type | 194 return base_idl_type |
195 if idl_type.is_union_type: | 195 if idl_type.is_union_type: |
196 # Avoid "AOrNullOrB" for cpp type of (A? or B) because we generate | 196 # Avoid "AOrNullOrB" for cpp type of (A? or B) because we generate |
197 # V8AOrBOrNull to handle nulle for (A? or B), (A or B?) and (A or B)? | 197 # V8AOrBOrNull to handle nulle for (A? or B), (A or B?) and (A or B)? |
198 def member_cpp_name(idl_type): | 198 def member_cpp_name(idl_type): |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 number_of_nullable_member_types_union) | 914 number_of_nullable_member_types_union) |
915 | 915 |
916 | 916 |
917 def includes_nullable_type_union(idl_type): | 917 def includes_nullable_type_union(idl_type): |
918 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type | 918 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type |
919 return idl_type.number_of_nullable_member_types == 1 | 919 return idl_type.number_of_nullable_member_types == 1 |
920 | 920 |
921 IdlTypeBase.includes_nullable_type = False | 921 IdlTypeBase.includes_nullable_type = False |
922 IdlNullableType.includes_nullable_type = True | 922 IdlNullableType.includes_nullable_type = True |
923 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) | 923 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) |
OLD | NEW |