| OLD | NEW |
| 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 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 | 927 |
| 928 | 928 |
| 929 ################################################################################ | 929 ################################################################################ |
| 930 # Special operations (methods) | 930 # Special operations (methods) |
| 931 # http://heycam.github.io/webidl/#idl-special-operations | 931 # http://heycam.github.io/webidl/#idl-special-operations |
| 932 ################################################################################ | 932 ################################################################################ |
| 933 | 933 |
| 934 def property_getter(getter, cpp_arguments): | 934 def property_getter(getter, cpp_arguments): |
| 935 def is_null_expression(idl_type): | 935 def is_null_expression(idl_type): |
| 936 if idl_type.is_union_type: | 936 if idl_type.is_union_type: |
| 937 return ' && '.join('!result%sEnabled' % i | 937 return ' && '.join('result%s.isNull()' % i |
| 938 for i, _ in enumerate(idl_type.member_types)) | 938 for i, _ in enumerate(idl_type.member_types)) |
| 939 if idl_type.name == 'String': | 939 if idl_type.name == 'String': |
| 940 return 'result.isNull()' | 940 return 'result.isNull()' |
| 941 if idl_type.is_interface_type: | 941 if idl_type.is_interface_type: |
| 942 return '!result' | 942 return '!result' |
| 943 return '' | 943 return '' |
| 944 | 944 |
| 945 idl_type = getter.idl_type | 945 idl_type = getter.idl_type |
| 946 extended_attributes = getter.extended_attributes | 946 extended_attributes = getter.extended_attributes |
| 947 is_raises_exception = 'RaisesException' in extended_attributes | 947 is_raises_exception = 'RaisesException' in extended_attributes |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 deleter = next( | 1108 deleter = next( |
| 1109 method | 1109 method |
| 1110 for method in interface.operations | 1110 for method in interface.operations |
| 1111 if ('deleter' in method.specials and | 1111 if ('deleter' in method.specials and |
| 1112 len(method.arguments) == 1 and | 1112 len(method.arguments) == 1 and |
| 1113 str(method.arguments[0].idl_type) == 'DOMString')) | 1113 str(method.arguments[0].idl_type) == 'DOMString')) |
| 1114 except StopIteration: | 1114 except StopIteration: |
| 1115 return None | 1115 return None |
| 1116 | 1116 |
| 1117 return property_deleter(deleter) | 1117 return property_deleter(deleter) |
| OLD | NEW |