Remove unused SyntaxShape::Variable (#10511)

# Description
We don't use this shape during parsing and never reference it in command
signatures. Thus it should be removed.

# User-Facing Changes
None functional.
Plugin authors that used it would never be provided with data that
specifically matched `SyntaxShape::Variable`
Builds using it will now fail.

# Tests + Formatting
NA
This commit is contained in:
Stefan Holderbach 2023-09-28 11:53:03 +02:00 committed by GitHub
parent cc767463e6
commit d1dc610769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 6 deletions

View File

@ -2743,7 +2743,6 @@ pub fn parse_shape_name(
b"signature" => SyntaxShape::Signature, b"signature" => SyntaxShape::Signature,
b"string" => SyntaxShape::String, b"string" => SyntaxShape::String,
_ if bytes.starts_with(b"table") => parse_collection_shape(working_set, bytes, span), _ if bytes.starts_with(b"table") => parse_collection_shape(working_set, bytes, span),
b"variable" => SyntaxShape::Variable,
b"var-with-opt-type" => SyntaxShape::VarWithOptType, b"var-with-opt-type" => SyntaxShape::VarWithOptType,
_ => { _ => {
if bytes.contains(&b'@') { if bytes.contains(&b'@') {

View File

@ -110,9 +110,6 @@ pub enum SyntaxShape {
/// A table is allowed, eg `[[first, second]; [1, 2]]` /// A table is allowed, eg `[[first, second]; [1, 2]]`
Table(Vec<(String, SyntaxShape)>), Table(Vec<(String, SyntaxShape)>),
/// A variable name, eg `$foo`
Variable,
/// A variable with optional type, `x` or `x: int` /// A variable with optional type, `x` or `x: int`
VarWithOptType, VarWithOptType,
} }
@ -164,7 +161,6 @@ impl SyntaxShape {
SyntaxShape::String => Type::String, SyntaxShape::String => Type::String,
SyntaxShape::Table(columns) => Type::Table(mk_ty(columns)), SyntaxShape::Table(columns) => Type::Table(mk_ty(columns)),
SyntaxShape::VarWithOptType => Type::Any, SyntaxShape::VarWithOptType => Type::Any,
SyntaxShape::Variable => Type::Any,
} }
} }
} }
@ -226,7 +222,6 @@ impl Display for SyntaxShape {
SyntaxShape::Operator => write!(f, "operator"), SyntaxShape::Operator => write!(f, "operator"),
SyntaxShape::RowCondition => write!(f, "condition"), SyntaxShape::RowCondition => write!(f, "condition"),
SyntaxShape::MathExpression => write!(f, "variable"), SyntaxShape::MathExpression => write!(f, "variable"),
SyntaxShape::Variable => write!(f, "var"),
SyntaxShape::VarWithOptType => write!(f, "vardecl"), SyntaxShape::VarWithOptType => write!(f, "vardecl"),
SyntaxShape::Signature => write!(f, "signature"), SyntaxShape::Signature => write!(f, "signature"),
SyntaxShape::MatchPattern => write!(f, "match-pattern"), SyntaxShape::MatchPattern => write!(f, "match-pattern"),