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

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

Issue 116153002: IDL compiler: [NamedConstructor] (basic) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revised Created 7 years 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/unstable/idl_definitions_builder.py ('k') | Source/bindings/templates/interface.h » ('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 ff6252342c4f02ad776955649d2014808d2dea8f..a6eadb7906a5c92138b98b3571a570d9ede01257 100644
--- a/Source/bindings/scripts/unstable/v8_interface.py
+++ b/Source/bindings/scripts/unstable/v8_interface.py
@@ -94,26 +94,38 @@ def generate_interface(interface):
# Constructors
constructors = [generate_constructor(interface, constructor)
- for constructor in interface.constructors]
+ for constructor in interface.constructors
+ # FIXME: shouldn't put named constructors with constructors
+ # (currently needed for Perl compatibility)
+ # Handle named constructors separately
+ if constructor.name == 'Constructor']
generate_constructor_overloads(constructors)
- if constructors:
- includes.add('bindings/v8/V8ObjectConstructor.h')
# [CustomConstructor]
has_custom_constructor = 'CustomConstructor' in extended_attributes
- if has_custom_constructor:
- includes.add('bindings/v8/V8ObjectConstructor.h')
# [EventConstructor]
has_event_constructor = 'EventConstructor' in extended_attributes
any_type_attributes = [attribute for attribute in interface.attributes
if attribute.idl_type == 'any']
if has_event_constructor:
- includes.update(['bindings/v8/Dictionary.h',
- 'bindings/v8/V8ObjectConstructor.h'])
+ includes.add('bindings/v8/Dictionary.h')
if any_type_attributes:
includes.add('bindings/v8/SerializedScriptValue.h')
+ # [NamedConstructor]
+ if 'NamedConstructor' in extended_attributes:
+ # FIXME: parser should return named constructor separately;
+ # included in constructors (and only name stored in extended attribute)
+ # for Perl compatibility
+ named_constructor = {'name': extended_attributes['NamedConstructor']}
+ else:
+ named_constructor = None
+
+ if (constructors or has_custom_constructor or has_event_constructor or
+ named_constructor):
+ includes.add('bindings/v8/V8ObjectConstructor.h')
+
template_contents = {
'any_type_attributes': any_type_attributes,
'conditional_string': conditional_string(interface), # [Conditional]
@@ -141,6 +153,7 @@ def generate_interface(interface):
'is_constructor_raises_exception': extended_attributes.get('RaisesException') == 'Constructor', # [RaisesException=Constructor]
'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, # [DependentLifetime]
'measure_as': v8_utilities.measure_as(interface), # [MeasureAs]
+ 'named_constructor': named_constructor,
'parent_interface': parent_interface,
'runtime_enabled_function': runtime_enabled_function_name(interface), # [RuntimeEnabled]
'special_wrap_for': special_wrap_for,
« no previous file with comments | « Source/bindings/scripts/unstable/idl_definitions_builder.py ('k') | Source/bindings/templates/interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698