aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-02-28 00:33:11 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-02-28 00:33:11 -0800
commite3970f9cbbd00289c551f947db0f4644654bd8d9 (patch)
tree6369fb3b8ab4b6f468b20c168030a76a4eba7db5 /src/parser.h
parent077757a30b0ccd930b28cf3ed52d6c7a938156be (diff)
Allow parse_execution_context to take ownership of a parse tree
Introduces a new template moved_ref which is like an rvalue reference. This allows passing around objects while being explicit that the receiver may acquire ownership. This will help reduce some allocations.
Diffstat (limited to 'src/parser.h')
-rw-r--r--src/parser.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/parser.h b/src/parser.h
index db35471b..af470d36 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -296,6 +296,11 @@ public:
\return 0 on success, 1 otherwise
*/
int eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t block_type);
+
+ /**
+ Evaluate the expressions contained in cmd, which has been parsed into the given parse tree. This takes ownership of the tree.
+ */
+ int eval_acquiring_tree(const wcstring &cmd, const io_chain_t &io, enum block_type_t block_type, moved_ref<parse_node_tree_t> t);
/** Evaluates a block node at the given node offset in the topmost execution context */
int eval_block_node(node_offset_t node_idx, const io_chain_t &io, enum block_type_t block_type);