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

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

Issue 340443004: IDL: reuse more code between CG for methods and constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rename scriptContext -> executionContext Created 6 years, 6 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/v8_attributes.py ('k') | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_interface.py
diff --git a/Source/bindings/scripts/v8_interface.py b/Source/bindings/scripts/v8_interface.py
index 610fbc5c04a6ed70a7315cb159a1f22fff83a4c8..ba92cdeeabde50d89c9bac46f7fb3143e13eba0f 100644
--- a/Source/bindings/scripts/v8_interface.py
+++ b/Source/bindings/scripts/v8_interface.py
@@ -837,13 +837,14 @@ def generate_constructor(interface, constructor):
for argument in constructor.arguments)
return {
- 'argument_list': constructor_argument_list(interface, constructor),
'arguments': [v8_methods.generate_argument(interface, constructor, argument, index)
for index, argument in enumerate(constructor.arguments)],
'arguments_need_try_catch': arguments_need_try_catch,
'cpp_type': cpp_template_type(
cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)),
cpp_name(interface)),
+ 'cpp_value': v8_methods.cpp_value(
+ interface, constructor, len(constructor.arguments)),
'has_exception_state':
# [RaisesException=Constructor]
interface.extended_attributes.get('RaisesException') == 'Constructor' or
@@ -857,24 +858,6 @@ def generate_constructor(interface, constructor):
}
-def constructor_argument_list(interface, constructor):
- arguments = []
- # [ConstructorCallWith=ExecutionContext]
- if has_extended_attribute_value(interface, 'ConstructorCallWith', 'ExecutionContext'):
- arguments.append('context')
- # [ConstructorCallWith=Document]
- if has_extended_attribute_value(interface, 'ConstructorCallWith', 'Document'):
- arguments.append('document')
-
- arguments.extend([argument.name for argument in constructor.arguments])
-
- # [RaisesException=Constructor]
- if interface.extended_attributes.get('RaisesException') == 'Constructor':
- arguments.append('exceptionState')
-
- return arguments
-
-
# [NamedConstructor]
def generate_named_constructor(interface):
extended_attributes = interface.extended_attributes
@@ -883,9 +866,9 @@ def generate_named_constructor(interface):
# FIXME: parser should return named constructor separately;
# included in constructors (and only name stored in extended attribute)
# for Perl compatibility
- idl_constructor = interface.constructors[0]
+ idl_constructor = interface.constructors[-1]
+ assert idl_constructor.name == 'NamedConstructor'
constructor = generate_constructor(interface, idl_constructor)
- constructor['argument_list'].insert(0, '*document')
constructor.update({
'name': extended_attributes['NamedConstructor'],
'is_named_constructor': True,
« no previous file with comments | « Source/bindings/scripts/v8_attributes.py ('k') | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698