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

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

Issue 270573005: Move modules-dependent IDL statements out of core by supporting 'implements' in RHS interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
Index: Source/bindings/scripts/utilities.py
diff --git a/Source/bindings/scripts/utilities.py b/Source/bindings/scripts/utilities.py
index 0f16281b79fb434dd877b586cb211b245dc9a9ad..a8af9d50da6d4c07c538c176b37859ac5c970be0 100644
--- a/Source/bindings/scripts/utilities.py
+++ b/Source/bindings/scripts/utilities.py
@@ -61,12 +61,24 @@ def get_partial_interface_name_from_idl(file_contents):
def get_implemented_interfaces_from_idl(file_contents, interface_name):
# Rule is: identifier-A implements identifier-B;
# http://www.w3.org/TR/WebIDL/#idl-implements-statements
- def get_implemented(left_identifier, right_identifier):
- # identifier-A must be the current interface
- if left_identifier != interface_name:
- raise IdlBadFilenameError("Identifier on the left of the 'implements' statement should be %s in %s.idl, but found %s" % (interface_name, interface_name, left_identifier))
- return right_identifier
+ implements_re = (r'^\s*'
+ r'(\w+)\s+'
+ r'implements\s+'
+ r'(\w+)\s*'
+ r';')
+ implements_matches = re.finditer(implements_re, file_contents, re.MULTILINE)
+ implements_pairs = [(match.group(1), match.group(2))
+ for match in implements_matches]
+ implemented_interfaces = []
+ for left, right in implements_pairs:
+ if left == interface_name:
+ implemented_interfaces.append(right)
+ return implemented_interfaces
+
+def get_source_interfaces_from_idl(file_contents, interface_name):
+ # Rule is: identifier-A implements identifier-B;
+ # http://www.w3.org/TR/WebIDL/#idl-implements-statements
implements_re = (r'^\s*'
Inactive 2014/05/07 20:00:27 The code duplication with get_implemented_interfac
r'(\w+)\s+'
r'implements\s+'
@@ -75,7 +87,11 @@ def get_implemented_interfaces_from_idl(file_contents, interface_name):
implements_matches = re.finditer(implements_re, file_contents, re.MULTILINE)
implements_pairs = [(match.group(1), match.group(2))
for match in implements_matches]
- return [get_implemented(left, right) for left, right in implements_pairs]
+ source_interfaces = []
+ for left, right in implements_pairs:
+ if right == interface_name:
+ source_interfaces.append(left)
+ return source_interfaces
def is_callback_interface_from_idl(file_contents):

Powered by Google App Engine
This is Rietveld 408576698