Remove the Value::Block case (#12582)

# Description
`Value` describes the types of first-class values that users and scripts
can create, manipulate, pass around, and store. However, `Block`s are
not first-class values in the language, so this PR removes it from
`Value`. This removes some unnecessary code, and this change should be
invisible to the user except for the change to `scope modules` described
below.

# User-Facing Changes
Breaking change: the output of `scope modules` was changed so that
`env_block` is now `has_env_block` which is a boolean value instead of a
`Block`.

# After Submitting
Update the language guide possibly.
This commit is contained in:
Ian Manske
2024-04-21 05:03:33 +00:00
committed by GitHub
parent 5fd34320e9
commit 3b1d405b96
32 changed files with 171 additions and 352 deletions

View File

@ -475,11 +475,6 @@ impl<'e, 's> ScopeData<'e, 's> {
sort_rows(&mut export_submodules);
sort_rows(&mut export_consts);
let export_env_block = module.env_block.map_or_else(
|| Value::nothing(span),
|block_id| Value::block(block_id, span),
);
let (module_usage, module_extra_usage) = self
.engine_state
.build_module_usage(*module_id)
@ -493,7 +488,7 @@ impl<'e, 's> ScopeData<'e, 's> {
"externs" => Value::list(export_externs, span),
"submodules" => Value::list(export_submodules, span),
"constants" => Value::list(export_consts, span),
"env_block" => export_env_block,
"has_env_block" => Value::bool(module.env_block.is_some(), span),
"usage" => Value::string(module_usage, span),
"extra_usage" => Value::string(module_extra_usage, span),
"module_id" => Value::int(*module_id as i64, span),