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

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

Issue 871443002: IDL: Further improve indexed/named property setter type checking (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | Source/bindings/templates/interface.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 # coding=utf-8 2 # coding=utf-8
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 1176
1177 1177
1178 def property_setter(interface, setter): 1178 def property_setter(interface, setter):
1179 idl_type = setter.arguments[1].idl_type 1179 idl_type = setter.arguments[1].idl_type
1180 extended_attributes = setter.extended_attributes 1180 extended_attributes = setter.extended_attributes
1181 is_raises_exception = 'RaisesException' in extended_attributes 1181 is_raises_exception = 'RaisesException' in extended_attributes
1182 restricted_float = ( 1182 restricted_float = (
1183 has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or 1183 has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or
1184 has_extended_attribute_value(setter, 'TypeChecking', 'Unrestricted')) 1184 has_extended_attribute_value(setter, 'TypeChecking', 'Unrestricted'))
1185 return { 1185 return {
1186 'has_exception_state': (is_raises_exception or
1187 idl_type.v8_conversion_needs_exception_state),
1186 'has_type_checking_interface': 1188 'has_type_checking_interface':
1187 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or 1189 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or
1188 has_extended_attribute_value(setter, 'TypeChecking', 'Interface')) and 1190 has_extended_attribute_value(setter, 'TypeChecking', 'Interface')) and
1189 idl_type.is_wrapper_type, 1191 idl_type.is_wrapper_type,
1190 'idl_type': idl_type.base_type, 1192 'idl_type': idl_type.base_type,
1191 'is_custom': 'Custom' in extended_attributes, 1193 'is_custom': 'Custom' in extended_attributes,
1192 'has_exception_state': (is_raises_exception or 1194 'is_nullable': idl_type.is_nullable,
1193 idl_type.v8_conversion_needs_exception_state),
1194 'is_raises_exception': is_raises_exception, 1195 'is_raises_exception': is_raises_exception,
1195 'name': cpp_name(setter), 1196 'name': cpp_name(setter),
1196 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( 1197 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value(
1197 extended_attributes, 'v8Value', 'propertyValue', restricted_float), 1198 extended_attributes, 'v8Value', 'propertyValue', restricted_float),
1198 } 1199 }
1199 1200
1200 1201
1201 def property_deleter(deleter): 1202 def property_deleter(deleter):
1202 idl_type = deleter.idl_type 1203 idl_type = deleter.idl_type
1203 if str(idl_type) != 'boolean': 1204 if str(idl_type) != 'boolean':
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 deleter = next( 1311 deleter = next(
1311 method 1312 method
1312 for method in interface.operations 1313 for method in interface.operations
1313 if ('deleter' in method.specials and 1314 if ('deleter' in method.specials and
1314 len(method.arguments) == 1 and 1315 len(method.arguments) == 1 and
1315 str(method.arguments[0].idl_type) == 'DOMString')) 1316 str(method.arguments[0].idl_type) == 'DOMString'))
1316 except StopIteration: 1317 except StopIteration:
1317 return None 1318 return None
1318 1319
1319 return property_deleter(deleter) 1320 return property_deleter(deleter)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698