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

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

Issue 332683004: IDL parser: fix rebuilding of (stale) cached parser tables (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add comment Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/blink_idl_parser.py
diff --git a/Source/bindings/scripts/blink_idl_parser.py b/Source/bindings/scripts/blink_idl_parser.py
index 6b205f2421c0c3f18ac2d51bad1fdce7988fe697..0120654a5f44083573025fb02f43aaec2876e8aa 100644
--- a/Source/bindings/scripts/blink_idl_parser.py
+++ b/Source/bindings/scripts/blink_idl_parser.py
@@ -380,6 +380,8 @@ class BlinkIDLParser(IDLParser):
def __init__(self,
# common parameters
debug=False,
+ # local parameters
+ rewrite_tables=False,
# idl_parser parameters
lexer=None, verbose=False, mute_error=False,
# yacc parameters
@@ -394,6 +396,11 @@ class BlinkIDLParser(IDLParser):
write_tables = True
if outputdir:
picklefile = picklefile or os.path.join(outputdir, 'parsetab.pickle')
+ if rewrite_tables:
+ try:
+ os.unlink(picklefile)
+ except OSError:
+ pass
lexer = lexer or BlinkIDLLexer(debug=debug,
outputdir=outputdir,
@@ -439,7 +446,10 @@ def main(argv):
except IndexError as err:
print 'Usage: %s OUTPUT_DIR' % argv[0]
return 1
- parser = BlinkIDLParser(outputdir=outputdir)
+ # Important: rewrite_tables=True causes the cache file to be deleted if it
+ # exists, thus making sure that PLY doesn't load it instead of regenerating
+ # the parse table.
+ parser = BlinkIDLParser(outputdir=outputdir, rewrite_tables=True)
if __name__ == '__main__':
« 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