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

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

Issue 789473002: Introduce [Exposed(Arguments)] in IDL code generator. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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/idl_definitions.py ('k') | Source/bindings/scripts/v8_utilities.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/utilities.py
diff --git a/Source/bindings/scripts/utilities.py b/Source/bindings/scripts/utilities.py
index 9ea01d71e6c45ecc1cf7f07086303d1542c8cab8..92119c2485aa54ac992c381a1e6d5edc4f46c22b 100644
--- a/Source/bindings/scripts/utilities.py
+++ b/Source/bindings/scripts/utilities.py
@@ -136,7 +136,7 @@ def is_callback_interface_from_idl(file_contents):
return bool(match)
-def get_interface_extended_attributes_from_idl(file_contents):
+def match_interface_extended_attributes_from_idl(file_contents):
# Strip comments
# re.compile needed b/c Python 2.6 doesn't support flags in re.sub
single_line_comment_re = re.compile(r'//.*$', flags=re.MULTILINE)
@@ -151,6 +151,11 @@ def get_interface_extended_attributes_from_idl(file_contents):
r'(:\s*\w+\s*)?'
r'{',
file_contents, flags=re.DOTALL)
+ return match
+
+
+def get_interface_extended_attributes_from_idl(file_contents):
+ match = match_interface_extended_attributes_from_idl(file_contents)
if not match:
return {}
@@ -166,3 +171,20 @@ def get_interface_extended_attributes_from_idl(file_contents):
name, _, value = map(string.strip, part.partition('='))
extended_attributes[name] = value
return extended_attributes
+
+
+def get_interface_exposed_arguments(file_contents):
+ match = match_interface_extended_attributes_from_idl(file_contents)
+ if not match:
+ return None
+
+ extended_attributes_string = match.group(1)
+ match = re.search(r'[^=]\bExposed\(([^)]*)\)', file_contents)
+ if not match:
+ return None
+ arguments = []
+ for argument in map(string.strip, match.group(1).split(',')):
+ exposed, runtime_enabled = argument.split()
+ arguments.append({'exposed': exposed, 'runtime_enabled': runtime_enabled})
+
+ return arguments
« no previous file with comments | « Source/bindings/scripts/idl_definitions.py ('k') | Source/bindings/scripts/v8_utilities.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698