Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: Source/bindings/scripts/v8_methods.py

Issue 259773008: Add support for type checking of floating point arguments as [TypeChecking=Unrestricted] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove outdated test Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/IDLExtendedAttributes.txt ('k') | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), 135 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value),
136 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings] 136 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings]
137 } 137 }
138 138
139 139
140 def generate_argument(interface, method, argument, index): 140 def generate_argument(interface, method, argument, index):
141 extended_attributes = argument.extended_attributes 141 extended_attributes = argument.extended_attributes
142 idl_type = argument.idl_type 142 idl_type = argument.idl_type
143 this_cpp_value = cpp_value(interface, method, index) 143 this_cpp_value = cpp_value(interface, method, index)
144 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type 144 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type
145
145 return { 146 return {
146 'cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=is_variadic_wrap per_type), 147 'cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=is_variadic_wrap per_type),
147 'cpp_value': this_cpp_value, 148 'cpp_value': this_cpp_value,
148 'enum_validation_expression': idl_type.enum_validation_expression, 149 'enum_validation_expression': idl_type.enum_validation_expression,
149 'has_default': 'Default' in extended_attributes, 150 'has_default': 'Default' in extended_attributes,
150 'has_event_listener_argument': any( 151 'has_event_listener_argument': any(
151 argument_so_far for argument_so_far in method.arguments[:index] 152 argument_so_far for argument_so_far in method.arguments[:index]
152 if argument_so_far.idl_type.name == 'EventListener'), 153 if argument_so_far.idl_type.name == 'EventListener'),
153 'has_legacy_overload_string': # [LegacyOverloadString] 154 'has_legacy_overload_string': # [LegacyOverloadString]
154 'LegacyOverloadString' in extended_attributes, 155 'LegacyOverloadString' in extended_attributes,
155 'has_type_checking_interface': 156 'has_type_checking_interface':
156 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or 157 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or
157 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and 158 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and
158 idl_type.is_wrapper_type, 159 idl_type.is_wrapper_type,
160 'has_type_checking_unrestricted':
161 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestrict ed') or
162 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted' )) and
163 idl_type.name in ('Float', 'Double'),
159 # Dictionary is special-cased, but arrays and sequences shouldn't be 164 # Dictionary is special-cased, but arrays and sequences shouldn't be
160 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type, 165 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type,
161 'idl_type_object': idl_type, 166 'idl_type_object': idl_type,
162 'index': index, 167 'index': index,
163 'is_clamp': 'Clamp' in extended_attributes, 168 'is_clamp': 'Clamp' in extended_attributes,
164 'is_callback_interface': idl_type.is_callback_interface, 169 'is_callback_interface': idl_type.is_callback_interface,
165 'is_nullable': idl_type.is_nullable, 170 'is_nullable': idl_type.is_nullable,
166 'is_optional': argument.is_optional, 171 'is_optional': argument.is_optional,
167 'is_variadic_wrapper_type': is_variadic_wrapper_type, 172 'is_variadic_wrapper_type': is_variadic_wrapper_type,
168 'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc _type), 173 'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc _type),
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 282
278 283
279 def union_arguments(idl_type): 284 def union_arguments(idl_type):
280 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 285 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
281 return [arg 286 return [arg
282 for i in range(len(idl_type.member_types)) 287 for i in range(len(idl_type.member_types))
283 for arg in ['result%sEnabled' % i, 'result%s' % i]] 288 for arg in ['result%sEnabled' % i, 'result%s' % i]]
284 289
285 IdlType.union_arguments = property(lambda self: None) 290 IdlType.union_arguments = property(lambda self: None)
286 IdlUnionType.union_arguments = property(union_arguments) 291 IdlUnionType.union_arguments = property(union_arguments)
OLDNEW
« no previous file with comments | « Source/bindings/IDLExtendedAttributes.txt ('k') | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698