Chromium Code Reviews| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 'Promise': 'ScriptPromise', | 113 'Promise': 'ScriptPromise', |
| 114 'ScriptValue': 'ScriptValue', | 114 'ScriptValue': 'ScriptValue', |
| 115 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345 529 | 115 # FIXME: Eliminate custom bindings for XPathNSResolver http://crbug.com/345 529 |
| 116 'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', | 116 'XPathNSResolver': 'RefPtrWillBeRawPtr<XPathNSResolver>', |
| 117 'boolean': 'bool', | 117 'boolean': 'bool', |
| 118 'unrestricted double': 'double', | 118 'unrestricted double': 'double', |
| 119 'unrestricted float': 'float', | 119 'unrestricted float': 'float', |
| 120 } | 120 } |
| 121 | 121 |
| 122 | 122 |
| 123 def cpp_type_initializer(idl_type): | |
| 124 """Returns a string containing a C++ initialization statement for the | |
| 125 corresponding type. | |
| 126 | |
| 127 |idl_type| argument is of type IdlType. | |
| 128 """ | |
| 129 | |
| 130 if (idl_type.is_numeric_type): | |
| 131 return ' = 0' | |
| 132 if idl_type.base_type == 'boolean': | |
| 133 return ' = false' | |
| 134 return '' | |
|
Jens Widell
2014/07/16 07:25:10
Return None by default?
Mostyn Bramley-Moore
2014/07/16 07:46:56
If I do that then we can't blindly use {{attribute
| |
| 135 | |
|
Jens Widell
2014/07/16 07:25:10
Two blank lines between function definitions.
I'd
Mostyn Bramley-Moore
2014/07/16 07:46:56
Done.
| |
| 123 def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_argumen t=False, used_as_variadic_argument=False, used_in_cpp_sequence=False): | 136 def cpp_type(idl_type, extended_attributes=None, raw_type=False, used_as_argumen t=False, used_as_variadic_argument=False, used_in_cpp_sequence=False): |
| 124 """Returns C++ type corresponding to IDL type. | 137 """Returns C++ type corresponding to IDL type. |
| 125 | 138 |
| 126 |idl_type| argument is of type IdlType, while return value is a string | 139 |idl_type| argument is of type IdlType, while return value is a string |
| 127 | 140 |
| 128 Args: | 141 Args: |
| 129 idl_type: | 142 idl_type: |
| 130 IdlType | 143 IdlType |
| 131 raw_type: | 144 raw_type: |
| 132 bool, True if idl_type's raw/primitive C++ type should be returned. | 145 bool, True if idl_type's raw/primitive C++ type should be returned. |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 741 | 754 |
| 742 def is_explicit_nullable(idl_type): | 755 def is_explicit_nullable(idl_type): |
| 743 # Nullable type that isn't implicit nullable (see above.) For such types, | 756 # Nullable type that isn't implicit nullable (see above.) For such types, |
| 744 # we use Nullable<T> or similar explicit ways to represent a null value. | 757 # we use Nullable<T> or similar explicit ways to represent a null value. |
| 745 return idl_type.is_nullable and not idl_type.is_implicit_nullable | 758 return idl_type.is_nullable and not idl_type.is_implicit_nullable |
| 746 | 759 |
| 747 IdlType.is_implicit_nullable = property(is_implicit_nullable) | 760 IdlType.is_implicit_nullable = property(is_implicit_nullable) |
| 748 IdlType.is_explicit_nullable = property(is_explicit_nullable) | 761 IdlType.is_explicit_nullable = property(is_explicit_nullable) |
| 749 IdlUnionType.is_implicit_nullable = False | 762 IdlUnionType.is_implicit_nullable = False |
| 750 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable) | 763 IdlUnionType.is_explicit_nullable = property(is_explicit_nullable) |
| OLD | NEW |