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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 for constructor in constructors) | 1037 for constructor in constructors) |
1038 | 1038 |
1039 | 1039 |
1040 ################################################################################ | 1040 ################################################################################ |
1041 # Special operations (methods) | 1041 # Special operations (methods) |
1042 # http://heycam.github.io/webidl/#idl-special-operations | 1042 # http://heycam.github.io/webidl/#idl-special-operations |
1043 ################################################################################ | 1043 ################################################################################ |
1044 | 1044 |
1045 def property_getter(getter, cpp_arguments): | 1045 def property_getter(getter, cpp_arguments): |
1046 def is_null_expression(idl_type): | 1046 def is_null_expression(idl_type): |
1047 if v8_methods.use_output_parameter_for_result(idl_type): | 1047 if idl_type.use_output_parameter_for_result: |
1048 return 'result.isNull()' | 1048 return 'result.isNull()' |
1049 if idl_type.name == 'String': | 1049 if idl_type.name == 'String': |
1050 return 'result.isNull()' | 1050 return 'result.isNull()' |
1051 if idl_type.is_interface_type: | 1051 if idl_type.is_interface_type: |
1052 return '!result' | 1052 return '!result' |
1053 return '' | 1053 return '' |
1054 | 1054 |
1055 idl_type = getter.idl_type | 1055 idl_type = getter.idl_type |
1056 extended_attributes = getter.extended_attributes | 1056 extended_attributes = getter.extended_attributes |
1057 is_raises_exception = 'RaisesException' in extended_attributes | 1057 is_raises_exception = 'RaisesException' in extended_attributes |
1058 use_output_parameter_for_result = v8_methods.use_output_parameter_for_result
(idl_type) | 1058 use_output_parameter_for_result = idl_type.use_output_parameter_for_result |
1059 | 1059 |
1060 # FIXME: make more generic, so can use v8_methods.cpp_value | 1060 # FIXME: make more generic, so can use v8_methods.cpp_value |
1061 cpp_method_name = 'impl->%s' % cpp_name(getter) | 1061 cpp_method_name = 'impl->%s' % cpp_name(getter) |
1062 | 1062 |
1063 if is_raises_exception: | 1063 if is_raises_exception: |
1064 cpp_arguments.append('exceptionState') | 1064 cpp_arguments.append('exceptionState') |
1065 if use_output_parameter_for_result: | 1065 if use_output_parameter_for_result: |
1066 cpp_arguments.append('result') | 1066 cpp_arguments.append('result') |
1067 | 1067 |
1068 cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) | 1068 cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 deleter = next( | 1218 deleter = next( |
1219 method | 1219 method |
1220 for method in interface.operations | 1220 for method in interface.operations |
1221 if ('deleter' in method.specials and | 1221 if ('deleter' in method.specials and |
1222 len(method.arguments) == 1 and | 1222 len(method.arguments) == 1 and |
1223 str(method.arguments[0].idl_type) == 'DOMString')) | 1223 str(method.arguments[0].idl_type) == 'DOMString')) |
1224 except StopIteration: | 1224 except StopIteration: |
1225 return None | 1225 return None |
1226 | 1226 |
1227 return property_deleter(deleter) | 1227 return property_deleter(deleter) |
OLD | NEW |