Remove node_offset from block_t

It was not used. Also clean up the constructor some.
This commit is contained in:
ridiculousfish 2018-02-11 20:10:57 -08:00
parent 8251d949f1
commit 3e063e7c13
3 changed files with 9 additions and 26 deletions

View file

@ -241,7 +241,6 @@ parse_execution_result_t parse_execution_context_t::run_if_statement(
tnode_t<g::if_statement> statement) {
// Push an if block.
if_block_t *ib = parser->push_block<if_block_t>();
ib->node_offset = this->get_offset(*statement);
parse_execution_result_t result = parse_execution_success;
@ -536,7 +535,6 @@ parse_execution_result_t parse_execution_context_t::run_while_statement(
tnode_t<grammar::while_header> header, tnode_t<grammar::job_list> contents) {
// Push a while block.
while_block_t *wb = parser->push_block<while_block_t>();
wb->node_offset = this->get_offset(header);
parse_execution_result_t ret = parse_execution_success;

View file

@ -802,17 +802,7 @@ void parser_t::get_backtrace(const wcstring &src, const parse_error_list_t &erro
}
}
block_t::block_t(block_type_t t)
: block_type(t),
skip(false),
tok_pos(),
node_offset(NODE_OFFSET_INVALID),
loop_status(LOOP_NORMAL),
job(),
src_filename(),
src_lineno(),
wants_pop_env(false),
event_blocks() {}
block_t::block_t(block_type_t t) : block_type(t) {}
block_t::~block_t() {}

View file

@ -75,31 +75,26 @@ struct block_t {
public:
/// Whether execution of the commands in this block should be skipped.
bool skip;
/// The start index of the block.
int tok_pos;
/// Offset of the node.
node_offset_t node_offset;
bool skip{false};
/// Status for the current loop block. Can be any of the values from the loop_status enum.
enum loop_status_t loop_status;
enum loop_status_t loop_status { LOOP_NORMAL };
/// The job that is currently evaluated in the specified block.
shared_ptr<job_t> job;
shared_ptr<job_t> job{};
/// Name of file that created this block. This string is intern'd.
const wchar_t *src_filename;
const wchar_t *src_filename{nullptr};
/// Line number where this block was created.
int src_lineno;
int src_lineno{0};
/// Whether we should pop the environment variable stack when we're popped off of the block
/// stack.
bool wants_pop_env;
bool wants_pop_env{false};
/// List of event blocks.
event_blockage_list_t event_blocks{};
block_type_t type() const { return this->block_type; }
/// Description of the block, for debugging.
wcstring description() const;
/// List of event blocks.
event_blockage_list_t event_blocks;
/// Destructor
virtual ~block_t();
};