When building trees in TestPerformance, compute checksum after the parse using ParseTreeWalker

This commit is contained in:
Sam Harwell 2013-11-14 13:31:48 -06:00
parent 49970a46b0
commit 320fada3e3
1 changed files with 5 additions and 2 deletions

View File

@ -1303,7 +1303,7 @@ public class TestPerformance extends BaseTest {
Object parseResult;
try {
if (COMPUTE_CHECKSUM) {
if (COMPUTE_CHECKSUM && !BUILD_PARSE_TREES) {
parser.addParseListener(new ChecksumParseTreeListener(checksum));
}
@ -1357,7 +1357,7 @@ public class TestPerformance extends BaseTest {
parser.addErrorListener(new SummarizingDiagnosticErrorListener());
parser.getInterpreter().setPredictionMode(PredictionMode.LL);
parser.setBuildParseTree(BUILD_PARSE_TREES);
if (COMPUTE_CHECKSUM) {
if (COMPUTE_CHECKSUM && !BUILD_PARSE_TREES) {
parser.addParseListener(new ChecksumParseTreeListener(checksum));
}
if (!BUILD_PARSE_TREES && BLANK_LISTENER) {
@ -1371,6 +1371,9 @@ public class TestPerformance extends BaseTest {
}
assertThat(parseResult, instanceOf(ParseTree.class));
if (COMPUTE_CHECKSUM && BUILD_PARSE_TREES) {
ParseTreeWalker.DEFAULT.walk(new ChecksumParseTreeListener(checksum), (ParseTree)parseResult);
}
if (BUILD_PARSE_TREES && BLANK_LISTENER) {
ParseTreeWalker.DEFAULT.walk(listener, (ParseTree)parseResult);
}