Wrap up source code and a parse tree into a new type parsed_source_ref_t

This will make it unnecessary to carry around the parse tree and source
separately, and enable some simplifications.
This commit is contained in:
ridiculousfish
2017-12-22 14:40:15 -08:00
parent eeff32cde7
commit a99eecfad8
9 changed files with 95 additions and 78 deletions

View File

@@ -1043,7 +1043,7 @@ parser_test_error_bits_t parse_util_detect_errors_in_argument(const parse_node_t
parser_test_error_bits_t parse_util_detect_errors(const wcstring &buff_src,
parse_error_list_t *out_errors,
bool allow_incomplete,
parse_node_tree_t *out_tree) {
parsed_source_ref_t *out_pstree) {
parse_node_tree_t node_tree;
parse_error_list_t parse_errors;
@@ -1291,8 +1291,8 @@ parser_test_error_bits_t parse_util_detect_errors(const wcstring &buff_src,
*out_errors = std::move(parse_errors);
}
if (out_tree != NULL) {
*out_tree = std::move(node_tree);
if (out_pstree != NULL) {
*out_pstree = std::make_shared<parsed_source_t>(buff_src, std::move(node_tree));
}
return res;