diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2016-02-28 00:44:20 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2016-02-28 00:44:20 -0800 |
commit | 3633c51ad8aee79add7727457c998c42a1638f72 (patch) | |
tree | 79f762b29062e13f95648ffb0a7833949da64af1 /src/reader.cpp | |
parent | e3970f9cbbd00289c551f947db0f4644654bd8d9 (diff) |
Re-use the parse tree generated during error detection for execution
Prior to this fix, read_ni would use parse_util_detect_errors
to lint the script to run, and then parser_t::eval() to execute it.
Both functions would parse the script into a parse tree. This allows
us to re-use the parse tree, improving perfomance.
Diffstat (limited to 'src/reader.cpp')
-rw-r--r-- | src/reader.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/reader.cpp b/src/reader.cpp index 1b4f8d2d..3998e5a0 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -4258,9 +4258,10 @@ static int read_ni(int fd, const io_chain_t &io) } parse_error_list_t errors; - if (! parse_util_detect_errors(str, &errors, false /* do not accept incomplete */)) + parse_node_tree_t tree; + if (! parse_util_detect_errors(str, &errors, false /* do not accept incomplete */, &tree)) { - parser.eval(str, io, TOP); + parser.eval_acquiring_tree(str, io, TOP, moved_ref<parse_node_tree_t>(tree)); } else { |