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

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

Issue 670663002: IDL: Use IdlReader to compute interface_info_individual (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 2 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 8641c99093f2ee899f756caca5f0977c3cd1c983..2cbd359087fea582e96292bfb9322045c6532096 100644
--- a/Source/bindings/scripts/utilities.py
+++ b/Source/bindings/scripts/utilities.py
@@ -17,11 +17,6 @@ import subprocess
KNOWN_COMPONENTS = frozenset(['core', 'modules'])
-class IdlBadFilenameError(Exception):
- """Raised if an IDL filename disagrees with the interface name in the file."""
- pass
-
-
def idl_filename_to_interface_name(idl_filename):
# interface name is the root of the basename: InterfaceName.idl
return os.path.splitext(os.path.basename(idl_filename))[0]
@@ -136,65 +131,11 @@ def write_pickle_file(pickle_filename, data, only_if_changed):
# Leading and trailing context (e.g. following '{') used to avoid false matches.
################################################################################
-def get_partial_interface_name_from_idl(file_contents):
- match = re.search(r'partial\s+interface\s+(\w+)\s*{', file_contents)
- return match and match.group(1)
-
-
-def get_implements_from_idl(file_contents, interface_name):
- """Returns lists of implementing and implemented interfaces.
-
- Rule is: identifier-A implements identifier-B;
- i.e., implement*ing* implements implement*ed*;
- http://www.w3.org/TR/WebIDL/#idl-implements-statements
-
- Returns two lists of interfaces: identifier-As and identifier-Bs.
- An 'implements' statements can be present in the IDL file for either the
- implementing or the implemented interface, but not other files.
- """
- 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.groups() for match in implements_matches]
-
- foreign_implements = [pair for pair in implements_pairs
- if interface_name not in pair]
- if foreign_implements:
- left, right = foreign_implements.pop()
- raise IdlBadFilenameError(
- 'implements statement found in unrelated IDL file.\n'
- 'Statement is:\n'
- ' %s implements %s;\n'
- 'but filename is unrelated "%s.idl"' %
- (left, right, interface_name))
-
- return (
- [left for left, right in implements_pairs if right == interface_name],
- [right for left, right in implements_pairs if left == interface_name])
-
-
def is_callback_interface_from_idl(file_contents):
match = re.search(r'callback\s+interface\s+\w+\s*{', file_contents)
return bool(match)
-def is_dictionary_from_idl(file_contents):
- match = re.search(r'dictionary\s+\w+\s*{', file_contents)
- return bool(match)
-
-
-def get_parent_interface(file_contents):
- match = re.search(r'interface\s+'
- r'\w+\s*'
- r':\s*(\w+)\s*'
- r'{',
- file_contents)
- return match and match.group(1)
-
-
def get_interface_extended_attributes_from_idl(file_contents):
# Strip comments
# re.compile needed b/c Python 2.6 doesn't support flags in re.sub
@@ -225,14 +166,3 @@ 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_put_forward_interfaces_from_idl(file_contents):
- put_forwards_pattern = (r'\[[^\]]*PutForwards=[^\]]*\]\s+'
- r'readonly\s+'
- r'attribute\s+'
- r'(\w+)')
- return sorted(set(match.group(1)
- for match in re.finditer(put_forwards_pattern,
- file_contents,
- flags=re.DOTALL)))

Powered by Google App Engine
This is Rietveld 408576698