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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 364 |
365 def suppress_setter(interface_name, name): | 365 def suppress_setter(interface_name, name): |
366 name_to_find = '%s.set:%s' % (interface_name, name) | 366 name_to_find = '%s.set:%s' % (interface_name, name) |
367 wildcard_setter_to_find = '%s.set:*' % interface_name | 367 wildcard_setter_to_find = '%s.set:*' % interface_name |
368 return (name_to_find in IGNORE_MEMBERS or | 368 return (name_to_find in IGNORE_MEMBERS or |
369 _suppress_method(interface_name, name) or | 369 _suppress_method(interface_name, name) or |
370 wildcard_setter_to_find in IGNORE_MEMBERS) | 370 wildcard_setter_to_find in IGNORE_MEMBERS) |
371 | 371 |
372 | 372 |
373 # To suppress an IDL method or attribute with a particular Extended Attribute | 373 # To suppress an IDL method or attribute with a particular Extended Attribute |
374 # w/o a value e.g, StrictTypeChecking would be an empty set | 374 # w/o a value e.g, DartStrictTypeChecking would be an empty set |
375 # 'StrictTypeChecking': frozenset([]), | 375 # 'DartStrictTypeChecking': frozenset([]), |
376 IGNORE_EXTENDED_ATTRIBUTES = { | 376 IGNORE_EXTENDED_ATTRIBUTES = { |
377 # 'RuntimeEnabled': frozenset(['ExperimentalCanvasFeatures']), | 377 # 'RuntimeEnabled': frozenset(['ExperimentalCanvasFeatures']), |
378 } | 378 } |
379 | 379 |
380 | 380 |
381 # Return True if the method / attribute should be suppressed. | 381 # Return True if the method / attribute should be suppressed. |
382 def _suppress_extended_attributes(extended_attributes): | 382 def _suppress_extended_attributes(extended_attributes): |
383 if 'DartSuppress' in extended_attributes and extended_attributes.get('DartSu
ppress') == None: | 383 if 'DartSuppress' in extended_attributes and extended_attributes.get('DartSu
ppress') == None: |
384 return True | 384 return True |
385 | 385 |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 return 'isUndefinedOrNull(%s)' | 854 return 'isUndefinedOrNull(%s)' |
855 return '%s->IsNull()' | 855 return '%s->IsNull()' |
856 if argument['is_optional']: | 856 if argument['is_optional']: |
857 return '%s->IsUndefined()' | 857 return '%s->IsUndefined()' |
858 return None | 858 return None |
859 | 859 |
860 cpp_value = 'info[%s]' % index | 860 cpp_value = 'info[%s]' % index |
861 idl_type = argument['idl_type_object'] | 861 idl_type = argument['idl_type_object'] |
862 # FIXME(vsm): We need Dart specific checks for the rest of this method. | 862 # FIXME(vsm): We need Dart specific checks for the rest of this method. |
863 # FIXME: proper type checking, sharing code with attributes and methods | 863 # FIXME: proper type checking, sharing code with attributes and methods |
864 # FIXME(terry): StrictTypeChecking no longer supported; TypeChecking is | 864 # FIXME(terry): DartStrictTypeChecking no longer supported; TypeChecking is |
865 # new extended attribute. | 865 # new extended attribute. |
866 if idl_type.name == 'String' and argument['is_strict_type_checking']: | 866 if idl_type.name == 'String' and argument['is_strict_type_checking']: |
867 return ' || '.join(['isUndefinedOrNull(%s)' % cpp_value, | 867 return ' || '.join(['isUndefinedOrNull(%s)' % cpp_value, |
868 '%s->IsString()' % cpp_value, | 868 '%s->IsString()' % cpp_value, |
869 '%s->IsObject()' % cpp_value]) | 869 '%s->IsObject()' % cpp_value]) |
870 if idl_type.array_or_sequence_type: | 870 if idl_type.array_or_sequence_type: |
871 return '%s->IsArray()' % cpp_value | 871 return '%s->IsArray()' % cpp_value |
872 if idl_type.is_callback_interface: | 872 if idl_type.is_callback_interface: |
873 return ' || '.join(['%s->IsNull()' % cpp_value, | 873 return ' || '.join(['%s->IsNull()' % cpp_value, |
874 '%s->IsFunction()' % cpp_value]) | 874 '%s->IsFunction()' % cpp_value]) |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 release=idl_type
.release)} | 1092 release=idl_type
.release)} |
1093 | 1093 |
1094 | 1094 |
1095 def property_setter(interface, setter): | 1095 def property_setter(interface, setter): |
1096 idl_type = setter.arguments[1].idl_type | 1096 idl_type = setter.arguments[1].idl_type |
1097 extended_attributes = setter.extended_attributes | 1097 extended_attributes = setter.extended_attributes |
1098 interface_extended_attributes = interface.extended_attributes | 1098 interface_extended_attributes = interface.extended_attributes |
1099 is_raises_exception = 'RaisesException' in extended_attributes | 1099 is_raises_exception = 'RaisesException' in extended_attributes |
1100 return { | 1100 return { |
1101 'has_strict_type_checking': | 1101 'has_strict_type_checking': |
1102 'StrictTypeChecking' in extended_attributes and | 1102 'DartStrictTypeChecking' in extended_attributes and |
1103 idl_type.is_wrapper_type, | 1103 idl_type.is_wrapper_type, |
1104 'idl_type': idl_type.base_type, | 1104 'idl_type': idl_type.base_type, |
1105 'is_custom': 'Custom' in extended_attributes, | 1105 'is_custom': 'Custom' in extended_attributes, |
1106 'has_exception_state': is_raises_exception or | 1106 'has_exception_state': is_raises_exception or |
1107 idl_type.is_integer_type, | 1107 idl_type.is_integer_type, |
1108 'is_raises_exception': is_raises_exception, | 1108 'is_raises_exception': is_raises_exception, |
1109 'name': DartUtilities.cpp_name(setter), | 1109 'name': DartUtilities.cpp_name(setter), |
1110 'dart_value_to_local_cpp_value': idl_type.dart_value_to_local_cpp_value( | 1110 'dart_value_to_local_cpp_value': idl_type.dart_value_to_local_cpp_value( |
1111 interface_extended_attributes, extended_attributes, 'propertyValue',
False), | 1111 interface_extended_attributes, extended_attributes, 'propertyValue',
False), |
1112 } | 1112 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 deleter = next( | 1226 deleter = next( |
1227 method | 1227 method |
1228 for method in interface.operations | 1228 for method in interface.operations |
1229 if ('deleter' in method.specials and | 1229 if ('deleter' in method.specials and |
1230 len(method.arguments) == 1 and | 1230 len(method.arguments) == 1 and |
1231 str(method.arguments[0].idl_type) == 'DOMString')) | 1231 str(method.arguments[0].idl_type) == 'DOMString')) |
1232 except StopIteration: | 1232 except StopIteration: |
1233 return None | 1233 return None |
1234 | 1234 |
1235 return property_deleter(deleter) | 1235 return property_deleter(deleter) |
OLD | NEW |