mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Migrate function_info_t from header into .cpp file
This struct was not used outside of the .cpp file.
This commit is contained in:
parent
2fa705e4b2
commit
9cd24c042a
2 changed files with 30 additions and 29 deletions
|
@ -29,6 +29,34 @@
|
|||
#include "reader.h"
|
||||
#include "wutil.h" // IWYU pragma: keep
|
||||
|
||||
class function_info_t {
|
||||
public:
|
||||
/// Parsed source containing the function.
|
||||
const parsed_source_ref_t parsed_source;
|
||||
/// Node containing the function body, pointing into parsed_source.
|
||||
const tnode_t<grammar::job_list> body_node;
|
||||
/// Function description. Only the description may be changed after the function is created.
|
||||
wcstring description;
|
||||
/// File where this function was defined (intern'd string).
|
||||
const wchar_t *const definition_file;
|
||||
/// List of all named arguments for this function.
|
||||
const wcstring_list_t named_arguments;
|
||||
/// Mapping of all variables that were inherited from the function definition scope to their
|
||||
/// values.
|
||||
const std::map<wcstring, env_var_t> inherit_vars;
|
||||
/// Flag for specifying that this function was automatically loaded.
|
||||
const bool is_autoload;
|
||||
/// Set to true if invoking this function shadows the variables of the underlying function.
|
||||
const bool shadow_scope;
|
||||
|
||||
/// Constructs relevant information from the function_data.
|
||||
function_info_t(const function_data_t &data, const wchar_t *filename, bool autoload);
|
||||
|
||||
/// Used by function_copy.
|
||||
function_info_t(const function_info_t &data, const wchar_t *filename, bool autoload);
|
||||
};
|
||||
|
||||
|
||||
/// Table containing all functions.
|
||||
typedef std::unordered_map<wcstring, function_info_t> function_map_t;
|
||||
static function_map_t loaded_functions;
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
class parser_t;
|
||||
|
||||
/// Structure describing a function. This is used by the parser to store data on a function while
|
||||
/// parsing it. It is not used internally to store functions, the function_internal_data_t structure
|
||||
/// is used for that purpose. Parhaps these two should be merged.
|
||||
/// parsing it. It is not used internally to store functions, the function_info_t structure
|
||||
/// is used for that purpose. Parhaps this should be merged with function_info_t.
|
||||
struct function_data_t {
|
||||
/// Name of function.
|
||||
wcstring name;
|
||||
|
@ -38,33 +38,6 @@ struct function_data_t {
|
|||
bool shadow_scope;
|
||||
};
|
||||
|
||||
class function_info_t {
|
||||
public:
|
||||
/// Parsed source containing the function.
|
||||
const parsed_source_ref_t parsed_source;
|
||||
/// Node containing the function body, pointing into parsed_source.
|
||||
const tnode_t<grammar::job_list> body_node;
|
||||
/// Function description. Only the description may be changed after the function is created.
|
||||
wcstring description;
|
||||
/// File where this function was defined (intern'd string).
|
||||
const wchar_t *const definition_file;
|
||||
/// List of all named arguments for this function.
|
||||
const wcstring_list_t named_arguments;
|
||||
/// Mapping of all variables that were inherited from the function definition scope to their
|
||||
/// values.
|
||||
const std::map<wcstring, env_var_t> inherit_vars;
|
||||
/// Flag for specifying that this function was automatically loaded.
|
||||
const bool is_autoload;
|
||||
/// Set to true if invoking this function shadows the variables of the underlying function.
|
||||
const bool shadow_scope;
|
||||
|
||||
/// Constructs relevant information from the function_data.
|
||||
function_info_t(const function_data_t &data, const wchar_t *filename, bool autoload);
|
||||
|
||||
/// Used by function_copy.
|
||||
function_info_t(const function_info_t &data, const wchar_t *filename, bool autoload);
|
||||
};
|
||||
|
||||
/// Add a function.
|
||||
void function_add(const function_data_t &data, const parser_t &parser);
|
||||
|
||||
|
|
Loading…
Reference in a new issue