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

Side by Side Diff: Source/bindings/dart/scripts/dart_utilities.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 26 matching lines...) Expand all
37 ################################################################################ 37 ################################################################################
38 # Utility function exposed for Dart CodeGenerator. Only 6 methods are special 38 # Utility function exposed for Dart CodeGenerator. Only 6 methods are special
39 # to Dart the rest delegate to the v8_utilities functions. 39 # to Dart the rest delegate to the v8_utilities functions.
40 ################################################################################ 40 ################################################################################
41 41
42 42
43 import v8_types # Required 43 import v8_types # Required
44 import v8_utilities 44 import v8_utilities
45 45
46 46
47 def _enum_validation_expression(idl_type):
48 # FIXME: Add IdlEnumType, move property to derived type, and remove this che ck
49 if not idl_type.is_enum:
50 return None
51 return ' || '.join(['((String){param_name}) == "%s"' % enum_value
52 for enum_value in idl_type.enum_values])
53
54
47 def _scoped_name(interface, definition, base_name): 55 def _scoped_name(interface, definition, base_name):
48 # partial interfaces are implemented as separate classes, with their members 56 # partial interfaces are implemented as separate classes, with their members
49 # implemented as static member functions 57 # implemented as static member functions
50 partial_interface_implemented_as = definition.extended_attributes.get('Parti alInterfaceImplementedAs') 58 partial_interface_implemented_as = definition.extended_attributes.get('Parti alInterfaceImplementedAs')
51 if partial_interface_implemented_as: 59 if partial_interface_implemented_as:
52 return '%s::%s' % (partial_interface_implemented_as, base_name) 60 return '%s::%s' % (partial_interface_implemented_as, base_name)
53 if (definition.is_static or 61 if (definition.is_static or
54 definition.name in ('Constructor', 'NamedConstructor')): 62 definition.name in ('Constructor', 'NamedConstructor')):
55 return '%s::%s' % (v8_utilities.cpp_name(interface), base_name) 63 return '%s::%s' % (v8_utilities.cpp_name(interface), base_name)
56 return 'receiver->%s' % base_name 64 return 'receiver->%s' % base_name
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 DartUtilities = dart_utilities_monkey() 185 DartUtilities = dart_utilities_monkey()
178 186
179 DartUtilities.activity_logging_world_list = _activity_logging_world_list 187 DartUtilities.activity_logging_world_list = _activity_logging_world_list
180 DartUtilities.bool_to_cpp = _bool_to_cpp 188 DartUtilities.bool_to_cpp = _bool_to_cpp
181 DartUtilities.call_with_arguments = _call_with_arguments 189 DartUtilities.call_with_arguments = _call_with_arguments
182 DartUtilities.capitalize = v8_utilities.capitalize 190 DartUtilities.capitalize = v8_utilities.capitalize
183 DartUtilities.conditional_string = v8_utilities.conditional_string 191 DartUtilities.conditional_string = v8_utilities.conditional_string
184 DartUtilities.cpp_name = v8_utilities.cpp_name 192 DartUtilities.cpp_name = v8_utilities.cpp_name
185 DartUtilities.deprecate_as = _deprecate_as 193 DartUtilities.deprecate_as = _deprecate_as
186 DartUtilities.extended_attribute_value_contains = v8_utilities.extended_attribut e_value_contains 194 DartUtilities.extended_attribute_value_contains = v8_utilities.extended_attribut e_value_contains
187 DartUtilities.enum_validation_expression = v8_utilities.enum_validation_expressi on 195 DartUtilities.enum_validation_expression = _enum_validation_expression
188 DartUtilities.gc_type = v8_utilities.gc_type 196 DartUtilities.gc_type = v8_utilities.gc_type
189 DartUtilities.generate_native_entry = _generate_native_entry 197 DartUtilities.generate_native_entry = _generate_native_entry
190 DartUtilities.has_extended_attribute = v8_utilities.has_extended_attribute 198 DartUtilities.has_extended_attribute = v8_utilities.has_extended_attribute
191 DartUtilities.has_extended_attribute_value = v8_utilities.has_extended_attribute _value 199 DartUtilities.has_extended_attribute_value = v8_utilities.has_extended_attribute _value
192 DartUtilities.measure_as = _measure_as 200 DartUtilities.measure_as = _measure_as
193 DartUtilities.per_context_enabled_function_name = v8_utilities.per_context_enabl ed_function_name 201 DartUtilities.per_context_enabled_function_name = v8_utilities.per_context_enabl ed_function_name
194 DartUtilities.runtime_enabled_function_name = v8_utilities.runtime_enabled_funct ion_name 202 DartUtilities.runtime_enabled_function_name = v8_utilities.runtime_enabled_funct ion_name
195 DartUtilities.scoped_name = _scoped_name 203 DartUtilities.scoped_name = _scoped_name
196 DartUtilities.strip_suffix = v8_utilities.strip_suffix 204 DartUtilities.strip_suffix = v8_utilities.strip_suffix
197 DartUtilities.uncapitalize = v8_utilities.uncapitalize 205 DartUtilities.uncapitalize = v8_utilities.uncapitalize
198 DartUtilities.v8_class_name = v8_utilities.v8_class_name 206 DartUtilities.v8_class_name = v8_utilities.v8_class_name
OLDNEW
« no previous file with comments | « Source/bindings/dart/scripts/dart_types.py ('k') | Source/bindings/dart/scripts/templates/methods_cpp.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698