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

Side by Side Diff: Source/bindings/scripts/preprocess_idls.py

Issue 17591008: Commented IDL implements statements should not generate code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 match = re.search(r'partial\s+interface\s+(\w+)', file_contents) 67 match = re.search(r'partial\s+interface\s+(\w+)', file_contents)
68 if match: 68 if match:
69 return match.group(1) 69 return match.group(1)
70 return None 70 return None
71 71
72 72
73 # identifier-A implements identifier-B; 73 # identifier-A implements identifier-B;
74 # http://www.w3.org/TR/WebIDL/#idl-implements-statements 74 # http://www.w3.org/TR/WebIDL/#idl-implements-statements
75 def get_implemented_interfaces_from_idl(file_contents, interface_name): 75 def get_implemented_interfaces_from_idl(file_contents, interface_name):
76 implemented_interfaces = [] 76 implemented_interfaces = []
77 for match in re.finditer(r'(\w+)\s+implements\s+(\w+)\s*;', file_contents): 77 for match in re.finditer(r'^\s*(\w+)\s+implements\s+(\w+)\s*;', file_content s, re.MULTILINE):
78 # identifier-A must be the current interface 78 # identifier-A must be the current interface
79 assert match.group(1) == interface_name, \ 79 assert match.group(1) == interface_name, \
80 "Identifier on the left of the 'implements' statement should be %s in %s.idl, bu t found %s" % (interface_name, interface_name, match.group(1)) 80 "Identifier on the left of the 'implements' statement should be %s in %s.idl, bu t found %s" % (interface_name, interface_name, match.group(1))
81 implemented_interfaces.append(match.group(2)) 81 implemented_interfaces.append(match.group(2))
82 return implemented_interfaces 82 return implemented_interfaces
83 83
84 def is_callback_interface_from_idl(file_contents): 84 def is_callback_interface_from_idl(file_contents):
85 match = re.search(r'callback\s+interface\s+\w+', file_contents) 85 match = re.search(r'callback\s+interface\s+\w+', file_contents)
86 return match is not None 86 return match is not None
87 87
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 idl_files = [] 238 idl_files = []
239 with open(options.idl_files_list) as idl_files_list_file: 239 with open(options.idl_files_list) as idl_files_list_file:
240 for line in idl_files_list_file: 240 for line in idl_files_list_file:
241 idl_files.append(string.rstrip(line, '\n')) 241 idl_files.append(string.rstrip(line, '\n'))
242 resolved_supplementals = parse_idl_files(idl_files, options.window_construct ors_file, options.workercontext_constructors_file) 242 resolved_supplementals = parse_idl_files(idl_files, options.window_construct ors_file, options.workercontext_constructors_file)
243 write_dependency_file(options.supplemental_dependency_file, resolved_supplem entals, only_if_changed=options.write_file_only_if_changed) 243 write_dependency_file(options.supplemental_dependency_file, resolved_supplem entals, only_if_changed=options.write_file_only_if_changed)
244 244
245 245
246 if __name__ == '__main__': 246 if __name__ == '__main__':
247 main() 247 main()
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698