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

Side by Side Diff: Source/bindings/dart/scripts/dart_methods.py

Issue 906343002: Added enum checks since enums are now supported in the IDL (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/dartium
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 default_value = argument.default_cpp_value 123 default_value = argument.default_cpp_value
124 if context['has_default']: 124 if context['has_default']:
125 default_value = (argument.default_cpp_value or 125 default_value = (argument.default_cpp_value or
126 dart_types.default_cpp_value_for_cpp_type(idl_type)) 126 dart_types.default_cpp_value_for_cpp_type(idl_type))
127 # FIXMEDART: handle the drift between preprocessed type names in 1847 and 127 # FIXMEDART: handle the drift between preprocessed type names in 1847 and
128 # 1985 dartium builds in a more generic way. 128 # 1985 dartium builds in a more generic way.
129 if preprocessed_type == 'unrestricted float': 129 if preprocessed_type == 'unrestricted float':
130 preprocessed_type = 'float' 130 preprocessed_type = 'float'
131 if preprocessed_type == 'unrestricted double': 131 if preprocessed_type == 'unrestricted double':
132 preprocessed_type = 'double' 132 preprocessed_type = 'double'
133
134 dart_enum_expression = idl_type.enum_validation_expression
135 if dart_enum_expression:
136 dart_enum_expression = dart_enum_expression.format(param_name=argument.n ame)
133 context.update({ 137 context.update({
134 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut es, 138 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut es,
135 raw_type=True, 139 raw_type=True,
136 used_in_cpp_sequence=use_heap_vector_ type), 140 used_in_cpp_sequence=use_heap_vector_ type),
137 'cpp_value': this_cpp_value, 141 'cpp_value': this_cpp_value,
138 'local_cpp_type': local_cpp_type, 142 'local_cpp_type': local_cpp_type,
139 # FIXME: check that the default value's type is compatible with the argu ment's 143 # FIXME: check that the default value's type is compatible with the argu ment's
140 'default_value': default_value, 144 'default_value': default_value,
141 'enum_validation_expression': idl_type.enum_validation_expression, 145 'enum_validation_expression': dart_enum_expression,
142 'preprocessed_type': preprocessed_type, 146 'preprocessed_type': preprocessed_type,
143 'is_array_or_sequence_type': not not idl_type.native_array_element_type, 147 'is_array_or_sequence_type': not not idl_type.native_array_element_type,
144 'is_strict_type_checking': 'DartStrictTypeChecking' in extended_attribut es, 148 'is_strict_type_checking': 'DartStrictTypeChecking' in extended_attribut es,
145 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictio nary', 149 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictio nary',
146 'vector_type': 'WillBeHeapVector' if use_heap_vector_type else 'Vector', 150 'vector_type': 'WillBeHeapVector' if use_heap_vector_type else 'Vector',
147 'dart_set_return_value_for_main_world': dart_set_return_value(interface. name, method, 151 'dart_set_return_value_for_main_world': dart_set_return_value(interface. name, method,
148 this_cpp_v alue, for_main_world=True), 152 this_cpp_v alue, for_main_world=True),
149 'dart_set_return_value': dart_set_return_value(interface.name, method, t his_cpp_value), 153 'dart_set_return_value': dart_set_return_value(interface.name, method, t his_cpp_value),
150 'arg_index': arg_index, 154 'arg_index': arg_index,
151 'dart_value_dictionary_cpp_value': dart_dictionary_value_argument(argume nt, arg_index), 155 'dart_value_dictionary_cpp_value': dart_dictionary_value_argument(argume nt, arg_index),
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 # There is also some logic in systemnative.py to force a null check 277 # There is also some logic in systemnative.py to force a null check
274 # for the useCapture argument of those same methods that we may need to 278 # for the useCapture argument of those same methods that we may need to
275 # pull over. 279 # pull over.
276 null_check = ((argument.is_optional and idl_type.is_callback_interface) or 280 null_check = ((argument.is_optional and idl_type.is_callback_interface) or
277 (idl_type.name == 'Dictionary') or 281 (idl_type.name == 'Dictionary') or
278 (argument.default_value and argument.default_value.is_null)) 282 (argument.default_value and argument.default_value.is_null))
279 283
280 return idl_type.dart_value_to_local_cpp_value( 284 return idl_type.dart_value_to_local_cpp_value(
281 extended_attributes, name, null_check, has_type_checking_interface, 285 extended_attributes, name, null_check, has_type_checking_interface,
282 index=index, auto_scope=auto_scope) 286 index=index, auto_scope=auto_scope)
OLDNEW
« no previous file with comments | « Source/bindings/dart/scripts/dart_dictionary.py ('k') | Source/bindings/dart/scripts/dart_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698