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

Unified Diff: Source/bindings/scripts/unstable/v8_interface.py

Issue 148083004: IDL compiler: anonymous indexed property getters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/scripts/unstable/v8_methods.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/unstable/v8_interface.py
diff --git a/Source/bindings/scripts/unstable/v8_interface.py b/Source/bindings/scripts/unstable/v8_interface.py
index ed47f8285a116a0bbbe33d0fd4ae0a579552308b..abaccd7bcfa2f7f5eb530ff41801596b3b7915fe 100644
--- a/Source/bindings/scripts/unstable/v8_interface.py
+++ b/Source/bindings/scripts/unstable/v8_interface.py
@@ -207,7 +207,8 @@ def generate_interface(interface):
# Methods
methods = [v8_methods.generate_method(interface, method)
- for method in interface.operations]
+ for method in interface.operations
+ if method.name] # Skip anonymous special operations (methods)
generate_overloads(methods)
for method in methods:
method['do_generate_method_configuration'] = (
@@ -225,6 +226,10 @@ def generate_interface(interface):
'methods': methods,
})
+ template_contents.update({
+ 'anonymous_indexed_property_getter': anonymous_indexed_property_getter(interface),
+ })
+
return template_contents
@@ -469,3 +474,36 @@ def interface_length(interface, constructors):
return 0
return min(constructor['number_of_required_arguments']
for constructor in constructors)
+
+
+################################################################################
+# Special operations (methods)
+# http://heycam.github.io/webidl/#idl-special-operations
+################################################################################
+
+def anonymous_indexed_property_getter(interface):
+ try:
+ getter = next(
+ method
+ for method in interface.operations
+ if ('getter' in method.specials and
+ len(method.arguments) == 1 and
+ method.arguments[0].idl_type == 'unsigned long' and
+ not method.name))
+ except StopIteration:
+ return None
+
+ idl_type = getter.idl_type
+ extended_attributes = getter.extended_attributes
+ return {
+ 'cpp_type': v8_types.cpp_type(idl_type),
+ 'is_null_expression': getter_is_null_expression(idl_type),
+ 'name': extended_attributes['ImplementedAs'],
+ 'v8_set_return_value': v8_types.v8_set_return_value(idl_type, 'element', extended_attributes=extended_attributes, script_wrappable='collection'),
+ }
+
+
+def getter_is_null_expression(idl_type):
+ if idl_type == 'DOMString':
+ return 'element.isNull()'
+ return None
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/scripts/unstable/v8_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698