mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 01:51:14 -03:00
Revert "parser: try to avoid some strings being copied"
This reverts commit 7a74198aa3.
Believe it or not this commit actually increased copying. When accepting
a value you know you're going to take ownership of, just accept it by
value; then temporaries can invoke the move ctor and blah blah blah.
We really need a lightweight refcounted pass-by-value string to make this
less error prone.
This commit is contained in:
@@ -1135,7 +1135,7 @@ const parse_node_t *parse_node_tree_t::get_child(const parse_node_t &parent, nod
|
||||
return result;
|
||||
}
|
||||
|
||||
parsed_source_ref_t parse_source(const wcstring &src, parse_tree_flags_t flags, parse_error_list_t *errors,
|
||||
parsed_source_ref_t parse_source(wcstring src, parse_tree_flags_t flags, parse_error_list_t *errors,
|
||||
parse_token_type_t goal) {
|
||||
parse_node_tree_t tree;
|
||||
if (!parse_tree_from_string(src, flags, &tree, errors, goal)) return {};
|
||||
|
||||
@@ -233,7 +233,7 @@ struct parsed_source_t {
|
||||
};
|
||||
/// Return a shared pointer to parsed_source_t, or null on failure.
|
||||
using parsed_source_ref_t = std::shared_ptr<const parsed_source_t>;
|
||||
parsed_source_ref_t parse_source(const wcstring &src, parse_tree_flags_t flags, parse_error_list_t *errors,
|
||||
parsed_source_ref_t parse_source(wcstring src, parse_tree_flags_t flags, parse_error_list_t *errors,
|
||||
parse_token_type_t goal = symbol_job_list);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -618,7 +618,7 @@ profile_item_t *parser_t::create_profile_item() {
|
||||
return result;
|
||||
}
|
||||
|
||||
int parser_t::eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t block_type) {
|
||||
int parser_t::eval(wcstring cmd, const io_chain_t &io, enum block_type_t block_type) {
|
||||
// Parse the source into a tree, if we can.
|
||||
parse_error_list_t error_list;
|
||||
parsed_source_ref_t ps = parse_source(cmd, parse_flag_none, &error_list);
|
||||
|
||||
@@ -222,7 +222,7 @@ class parser_t : public std::enable_shared_from_this<parser_t> {
|
||||
/// \param block_type The type of block to push on the block stack
|
||||
///
|
||||
/// \return 0 on success, 1 on a parse error.
|
||||
int eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t block_type);
|
||||
int eval(wcstring cmd, const io_chain_t &io, enum block_type_t block_type);
|
||||
|
||||
/// Evaluate the parsed source ps.
|
||||
void eval(parsed_source_ref_t ps, const io_chain_t &io, enum block_type_t block_type);
|
||||
|
||||
Reference in New Issue
Block a user