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

Side by Side Diff: tools/js2c.py

Issue 1130253006: Fix build after revert at 28332. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 source_files = sorted(source_files, 424 source_files = sorted(source_files,
425 lambda l,r: IsDebuggerFile(r) - IsDebuggerFile(l)) 425 lambda l,r: IsDebuggerFile(r) - IsDebuggerFile(l))
426 426
427 source_files_and_contents = [(f, ReadFile(f)) for f in source_files] 427 source_files_and_contents = [(f, ReadFile(f)) for f in source_files]
428 428
429 # Have a single not-quite-empty source file if there are none present; 429 # Have a single not-quite-empty source file if there are none present;
430 # otherwise you get errors trying to compile an empty C++ array. 430 # otherwise you get errors trying to compile an empty C++ array.
431 # It cannot be empty (or whitespace, which gets trimmed to empty), as 431 # It cannot be empty (or whitespace, which gets trimmed to empty), as
432 # the deserialization code assumes each file is nonempty. 432 # the deserialization code assumes each file is nonempty.
433 if not source_files_and_contents: 433 if not source_files_and_contents:
434 source_files_and_contents = [("dummy.js", "void 0;")] 434 source_files_and_contents = [("dummy.js", "(function() {})")]
435 435
436 result = Sources() 436 result = Sources()
437 437
438 for (source, contents) in source_files_and_contents: 438 for (source, contents) in source_files_and_contents:
439 try: 439 try:
440 lines = filters(contents) 440 lines = filters(contents)
441 except Error as e: 441 except Error as e:
442 raise Error("In file %s:\n%s" % (source, str(e))) 442 raise Error("In file %s:\n%s" % (source, str(e)))
443 443
444 result.modules.append(lines) 444 result.modules.append(lines)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 parser.add_argument("--js", 592 parser.add_argument("--js",
593 help="writes a JS file output instead of a C file", 593 help="writes a JS file output instead of a C file",
594 action="store_true") 594 action="store_true")
595 595
596 args = vars(parser.parse_args()) 596 args = vars(parser.parse_args())
597 JS2C(args["sources.js"], args["out.cc"], args["type"], args["raw"], args["star tup_blob"], args["js"]) 597 JS2C(args["sources.js"], args["out.cc"], args["type"], args["raw"], args["star tup_blob"], args["js"])
598 598
599 599
600 if __name__ == "__main__": 600 if __name__ == "__main__":
601 main() 601 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698