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

Side by Side Diff: Source/bindings/dart/scripts/dart_dictionary.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
« no previous file with comments | « no previous file | Source/bindings/dart/scripts/dart_methods.py » ('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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Generate template contexts of dictionaries for both v8 bindings and 5 """Generate template contexts of dictionaries for both v8 bindings and
6 implementation classes that are used by blink's core/modules. 6 implementation classes that are used by blink's core/modules.
7 """ 7 """
8 8
9 import operator 9 import operator
10 from v8_globals import includes 10 from v8_globals import includes
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if member.default_value.is_null: 65 if member.default_value.is_null:
66 return None, 'v8::Null(isolate)' 66 return None, 'v8::Null(isolate)'
67 cpp_default_value = str(member.default_value) 67 cpp_default_value = str(member.default_value)
68 v8_default_value = idl_type.cpp_value_to_v8_value( 68 v8_default_value = idl_type.cpp_value_to_v8_value(
69 cpp_value=cpp_default_value, isolate='isolate', 69 cpp_value=cpp_default_value, isolate='isolate',
70 creation_context='creationContext') 70 creation_context='creationContext')
71 return cpp_default_value, v8_default_value 71 return cpp_default_value, v8_default_value
72 72
73 cpp_default_value, dart_default_value = default_values() 73 cpp_default_value, dart_default_value = default_values()
74 74
75 dart_enum_expression = idl_type.enum_validation_expression
76 if dart_enum_expression:
77 dart_enum_expression = dart_enum_expression.format(param_name='string')
78
75 return { 79 return {
76 'cpp_default_value': cpp_default_value, 80 'cpp_default_value': cpp_default_value,
77 'cpp_type': idl_type.cpp_type, 81 'cpp_type': idl_type.cpp_type,
78 'cpp_value_to_dart_value': idl_type.cpp_value_to_dart_value( 82 'cpp_value_to_dart_value': idl_type.cpp_value_to_dart_value(
79 cpp_value='impl->%s()' % member.name, 83 cpp_value='impl->%s()' % member.name,
80 creation_context='creationContext', 84 creation_context='creationContext',
81 extended_attributes=member.extended_attributes), 85 extended_attributes=member.extended_attributes),
82 'enum_validation_expression': idl_type.enum_validation_expression, 86 'enum_validation_expression': dart_enum_expression,
83 'has_method_name': has_method_name_for_dictionary_member(member), 87 'has_method_name': has_method_name_for_dictionary_member(member),
84 'is_object': idl_type.name == 'Object', 88 'is_object': idl_type.name == 'Object',
85 'name': member.name, 89 'name': member.name,
86 'setter_name': setter_name_for_dictionary_member(member), 90 'setter_name': setter_name_for_dictionary_member(member),
87 'dart_default_value': dart_default_value, 91 'dart_default_value': dart_default_value,
88 } 92 }
89 93
90 94
91 # Context for implementation classes 95 # Context for implementation classes
92 96
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 'has_method_expression': has_method_expression(), 140 'has_method_expression': has_method_expression(),
137 'has_method_name': has_method_name_for_dictionary_member(member), 141 'has_method_name': has_method_name_for_dictionary_member(member),
138 'is_object': is_object, 142 'is_object': is_object,
139 'is_traceable': (idl_type.is_garbage_collected or 143 'is_traceable': (idl_type.is_garbage_collected or
140 idl_type.is_will_be_garbage_collected), 144 idl_type.is_will_be_garbage_collected),
141 'member_cpp_type': member_cpp_type(), 145 'member_cpp_type': member_cpp_type(),
142 'name': member.name, 146 'name': member.name,
143 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), 147 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
144 'setter_name': setter_name_for_dictionary_member(member), 148 'setter_name': setter_name_for_dictionary_member(member),
145 } 149 }
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/dart/scripts/dart_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698