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

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

Issue 299203002: Support per-overload [RuntimeEnabled] extended attribute (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 unified diff | Download patch
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 code + 177 code +
178 '#endif // %s\n' % conditional_string) 178 '#endif // %s\n' % conditional_string)
179 179
180 180
181 # [RuntimeEnabled] 181 # [RuntimeEnabled]
182 def runtime_enabled_if(code, runtime_enabled_function_name): 182 def runtime_enabled_if(code, runtime_enabled_function_name):
183 if not runtime_enabled_function_name: 183 if not runtime_enabled_function_name:
184 return code 184 return code
185 # Indent if statement to level of original code 185 # Indent if statement to level of original code
186 indent = re.match(' *', code).group(0) 186 indent = re.match(' *', code).group(0)
187 return ('%sif (%s())\n' % (indent, runtime_enabled_function_name) + 187 return ('%sif (%s()) {\n' % (indent, runtime_enabled_function_name) +
188 ' %s' % code) 188 ' %s\n' % '\n '.join(code.splitlines()) +
189 '%s}\n' % indent)
189 190
190 191
191 ################################################################################ 192 ################################################################################
192 193
193 def main(argv): 194 def main(argv):
194 # If file itself executed, cache templates 195 # If file itself executed, cache templates
195 try: 196 try:
196 cache_dir = argv[1] 197 cache_dir = argv[1]
197 dummy_filename = argv[2] 198 dummy_filename = argv[2]
198 except IndexError as err: 199 except IndexError as err:
(...skipping 10 matching lines...) Expand all
209 210
210 # Create a dummy file as output for the build system, 211 # Create a dummy file as output for the build system,
211 # since filenames of individual cache files are unpredictable and opaque 212 # since filenames of individual cache files are unpredictable and opaque
212 # (they are hashes of the template path, which varies based on environment) 213 # (they are hashes of the template path, which varies based on environment)
213 with open(dummy_filename, 'w') as dummy_file: 214 with open(dummy_filename, 'w') as dummy_file:
214 pass # |open| creates or touches the file 215 pass # |open| creates or touches the file
215 216
216 217
217 if __name__ == '__main__': 218 if __name__ == '__main__':
218 sys.exit(main(sys.argv)) 219 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_interface.py » ('j') | Source/bindings/tests/results/V8TestObject.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698