Chromium Code Reviews| Index: Source/bindings/scripts/utilities.py |
| diff --git a/Source/bindings/scripts/utilities.py b/Source/bindings/scripts/utilities.py |
| index 0f16281b79fb434dd877b586cb211b245dc9a9ad..7c80fdb88cc694b8ea92a75cda1d2b1b98e85205 100644 |
| --- a/Source/bindings/scripts/utilities.py |
| +++ b/Source/bindings/scripts/utilities.py |
| @@ -58,15 +58,12 @@ def get_partial_interface_name_from_idl(file_contents): |
| return match and match.group(1) |
| -def get_implemented_interfaces_from_idl(file_contents, interface_name): |
| +def get_implements_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 |
| - |
| + # Returns two lists of interfaces that contain identifier-As and identifier-Bs. |
| + # The 'implements' statements are supported in both identifier-A IDL and identifier-B IDL |
| + # to avoid potential layering violation. |
| implements_re = (r'^\s*' |
| r'(\w+)\s+' |
| r'implements\s+' |
| @@ -75,7 +72,14 @@ 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] |
| + A_interfaces = [] |
| + B_interfaces = [] |
| + for left, right in implements_pairs: |
| + if left == interface_name: |
| + B_interfaces.append(right) |
| + elif right == interface_name: |
| + A_interfaces.append(left) |
| + return [A_interfaces, B_interfaces] |
|
Inactive
2014/05/07 21:45:05
You should return a tuple here:
return (A_interfac
c.shu
2014/05/07 21:52:40
Done.
|
| def is_callback_interface_from_idl(file_contents): |