remove extern-wrapped and export extern-wrapped (#11000)

follow-up to
- https://github.com/nushell/nushell/pull/10716

> **Important**
> wait for between 0.87 and 0.88 to land this

# Description
it's time for removal again 😋 
this PR removes `extern-wrapped` and `export extern-wrapped` in favor of
`def --wrapped`

# User-Facing Changes
`extern-wrapped` and `export extern-wrapped` will not be found anymore.

# Tests + Formatting

# After Submitting
This commit is contained in:
Antoine Stevan
2023-11-16 23:44:28 +01:00
committed by GitHub
parent e93e51d672
commit e0c8a3d14c
6 changed files with 18 additions and 173 deletions

View File

@ -47,9 +47,7 @@ pub const UNALIASABLE_PARSER_KEYWORDS: &[&[u8]] = &[
b"export def",
b"for",
b"extern",
b"extern-wrapped",
b"export extern",
b"export extern-wrapped",
b"alias",
b"export alias",
b"export-env",
@ -151,11 +149,7 @@ pub fn parse_def_predecl(working_set: &mut StateWorkingSet, spans: &[Span]) {
return;
};
if def_type_name != b"def"
&& def_type_name != b"def-env"
&& def_type_name != b"extern"
&& def_type_name != b"extern-wrapped"
{
if def_type_name != b"def" && def_type_name != b"def-env" && def_type_name != b"extern" {
return;
}
@ -635,9 +629,9 @@ pub fn parse_extern(
};
let extern_call = working_set.get_span_contents(name_span).to_vec();
if extern_call != b"extern" && extern_call != b"extern-wrapped" {
if extern_call != b"extern" {
working_set.error(ParseError::UnknownState(
"internal error: Wrong call name for extern or extern-wrapped command".into(),
"internal error: Wrong call name for extern command".into(),
span(spans),
));
return garbage_pipeline(spans);
@ -1055,8 +1049,9 @@ pub fn parse_export_in_block(
let full_name = if lite_command.parts.len() > 1 {
let sub = working_set.get_span_contents(lite_command.parts[1]);
match sub {
b"alias" | b"def" | b"def-env" | b"extern" | b"extern-wrapped" | b"use" | b"module"
| b"const" => [b"export ", sub].concat(),
b"alias" | b"def" | b"def-env" | b"extern" | b"use" | b"module" | b"const" => {
[b"export ", sub].concat()
}
_ => b"export".to_vec(),
}
} else {
@ -1121,7 +1116,6 @@ pub fn parse_export_in_block(
}
b"export module" => parse_module(working_set, lite_command, None).0,
b"export extern" => parse_extern(working_set, lite_command, None),
b"export extern-wrapped" => parse_extern(working_set, lite_command, None),
_ => {
working_set.error(ParseError::UnexpectedKeyword(
String::from_utf8_lossy(&full_name).to_string(),
@ -1290,7 +1284,7 @@ pub fn parse_export_in_module(
result
}
b"extern" | b"extern-wrapped" => {
b"extern" => {
let lite_command = LiteCommand {
comments: lite_command.comments.clone(),
parts: spans[1..].to_vec(),
@ -1303,7 +1297,7 @@ pub fn parse_export_in_module(
id
} else {
working_set.error(ParseError::InternalError(
"missing 'export extern' or 'export extern-wrapped' command".into(),
"missing 'export extern' command".into(),
export_span,
));
return (garbage_pipeline(spans), vec![]);
@ -1569,7 +1563,7 @@ pub fn parse_export_in_module(
}
_ => {
working_set.error(ParseError::Expected(
"def, def-env, alias, use, module, const, extern or extern-wrapped keyword",
"def, def-env, alias, use, module, const or extern keyword",
spans[1],
));
@ -1578,9 +1572,9 @@ pub fn parse_export_in_module(
}
} else {
working_set.error(ParseError::MissingPositional(
"def, def-env, alias, use, module, const, extern or extern-wrapped keyword".to_string(),
"def, def-env, alias, use, module, const or extern keyword".to_string(),
Span::new(export_span.end, export_span.end),
"def, def-env, alias, use, module, const, extern or extern-wrapped keyword".to_string(),
"def, def-env, alias, use, module, const or extern keyword".to_string(),
));
vec![]
@ -1762,11 +1756,9 @@ pub fn parse_module_block(
b"const" => block
.pipelines
.push(parse_const(working_set, &command.parts)),
b"extern" | b"extern-wrapped" => {
block
.pipelines
.push(parse_extern(working_set, command, None))
}
b"extern" => block
.pipelines
.push(parse_extern(working_set, command, None)),
b"alias" => {
block.pipelines.push(parse_alias(
working_set,
@ -1906,7 +1898,7 @@ pub fn parse_module_block(
}
_ => {
working_set.error(ParseError::ExpectedKeyword(
"def, const, def-env, extern, extern-wrapped, alias, use, module, export or export-env keyword".into(),
"def, const, def-env, extern, alias, use, module, export or export-env keyword".into(),
command.parts[0],
));

View File

@ -4918,8 +4918,8 @@ pub fn parse_expression(
// For now, check for special parses of certain keywords
match bytes.as_slice() {
b"def" | b"extern" | b"extern-wrapped" | b"for" | b"module" | b"use" | b"source"
| b"alias" | b"export" | b"hide" => {
b"def" | b"extern" | b"for" | b"module" | b"use" | b"source" | b"alias" | b"export"
| b"hide" => {
working_set.error(ParseError::BuiltinCommandInPipeline(
String::from_utf8(bytes)
.expect("builtin commands bytes should be able to convert to string"),
@ -5086,7 +5086,7 @@ pub fn parse_builtin_commands(
match name {
b"def" | b"def-env" => parse_def(working_set, lite_command, None).0,
b"extern" | b"extern-wrapped" => parse_extern(working_set, lite_command, None),
b"extern" => parse_extern(working_set, lite_command, None),
b"let" => parse_let(working_set, &lite_command.parts),
b"const" => parse_const(working_set, &lite_command.parts),
b"mut" => parse_mut(working_set, &lite_command.parts),