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

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

Issue 63643002: IDL compiler: [ImplementedAs] for methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 | « no previous file | Source/bindings/tests/idls/TestObjectPython.idl » ('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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if argument.idl_type in ['NodeFilter', 'XPathNSResolver']: 130 if argument.idl_type in ['NodeFilter', 'XPathNSResolver']:
131 # FIXME: remove this special case 131 # FIXME: remove this special case
132 return '%s.get()' % argument.name 132 return '%s.get()' % argument.name
133 return argument.name 133 return argument.name
134 134
135 # Truncate omitted optional arguments 135 # Truncate omitted optional arguments
136 arguments = method.arguments[:number_of_arguments] 136 arguments = method.arguments[:number_of_arguments]
137 cpp_arguments = v8_utilities.call_with_arguments(method) 137 cpp_arguments = v8_utilities.call_with_arguments(method)
138 cpp_arguments.extend(cpp_argument(argument) for argument in arguments) 138 cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
139 139
140 cpp_method_name = v8_utilities.scoped_name(interface, method, method.name) 140 cpp_method_name = v8_utilities.scoped_name(interface, method, v8_utilities.c pp_name(method))
141 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) 141 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
142 142
143 143
144 def v8_set_return_value(method, cpp_value): 144 def v8_set_return_value(method, cpp_value):
145 idl_type = method.idl_type 145 idl_type = method.idl_type
146 if idl_type == 'void': 146 if idl_type == 'void':
147 return None 147 return None
148 if has_extended_attribute_value(method, 'CallWith', 'ScriptState'): 148 if has_extended_attribute_value(method, 'CallWith', 'ScriptState'):
149 cpp_value = 'result' # use local variable for value 149 cpp_value = 'result' # use local variable for value
150 return v8_types.v8_set_return_value(idl_type, cpp_value) 150 return v8_types.v8_set_return_value(idl_type, cpp_value)
(...skipping 26 matching lines...) Expand all
177 if argument.is_variadic: 177 if argument.is_variadic:
178 return 'V8TRYCATCH_VOID(Vector<{cpp_type}>, {name}, toNativeArguments<{c pp_type}>(info, {index}))'.format( 178 return 'V8TRYCATCH_VOID(Vector<{cpp_type}>, {name}, toNativeArguments<{c pp_type}>(info, {index}))'.format(
179 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index) 179 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index)
180 if (argument.is_optional and idl_type == 'DOMString' and 180 if (argument.is_optional and idl_type == 'DOMString' and
181 extended_attributes.get('Default') == 'NullString'): 181 extended_attributes.get('Default') == 'NullString'):
182 v8_value = 'argumentOrNull(info, %s)' % index 182 v8_value = 'argumentOrNull(info, %s)' % index
183 else: 183 else:
184 v8_value = 'info[%s]' % index 184 v8_value = 'info[%s]' % index
185 return v8_types.v8_value_to_local_cpp_value( 185 return v8_types.v8_value_to_local_cpp_value(
186 idl_type, argument.extended_attributes, v8_value, name, index=index) 186 idl_type, argument.extended_attributes, v8_value, name, index=index)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/idls/TestObjectPython.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698