зеркало из https://github.com/mozilla/gecko-dev.git
72a1e0edd5
The IPDL parser handles include statements by using a stack of parsers. If an inner parser encounters a parsing error, it will print out an error message, which is maybe okay, but then it makes two mistakes: 1. It does not pop the current parser off of the parser stack. This means that the file that included the syntactically invalid file will be parsed as though it were the invalid file. In bkelly's case, an .ipdl file included an invalid .ipdlh file, so he got a bizarre error message about how you can't define a protocol in a header, because the parser was treating the protocol in the .ipdl file as though it were in the .ipdlh file. I fixed this by using a "finally" clause to pop the parser stack, ensuring that it is correct even in case of error. 2. A parse error in the include should cause the entire parse to fail, but instead it will keep going. inc.tu will get set to None, which eventually causes an error later in type checking, when it attempts to examine inc.tu. I fixed this by only catching the parse error where we invoke the outermost parser. This has the drawback that later errors in other files will not be reported. An alternate fix would set a global flag to indicate that a parse error had occured, and somehow report that to the caller. I think this bug was introduced in 2009 by commit cb8189926a69872c73508fba50830f0d07af341f. MozReview-Commit-ID: DhbDUO7MXGB --HG-- extra : rebase_source : cee371cd54ebf575f78aa8b2441afbde8b3c2b8f |
||
---|---|---|
.. | ||
ipdl | ||
test | ||
Makefile.in | ||
ipdl.py | ||
moz.build | ||
msgtype-components |