This commit is contained in:
JT 2021-09-13 19:31:11 +12:00
parent 648fe052db
commit eb67eab122
2 changed files with 15 additions and 11 deletions

View File

@ -1030,17 +1030,20 @@ pub fn parse_variable_expr(
None, None,
) )
} else { } else {
let name = working_set.get_span_contents(span).to_vec(); // let name = working_set.get_span_contents(span).to_vec();
// this seems okay to set it to unknown here, but we should double-check // this seems okay to set it to unknown here, but we should double-check
let id = working_set.add_variable(name, Type::Unknown); //let id = working_set.add_variable(name, Type::Unknown);
( // (
Expression { // Expression {
expr: Expr::Var(id), // expr: Expr::Var(id),
span, // span,
ty: Type::Unknown, // ty: Type::Unknown,
}, // },
None, // None,
) // )
// } else {
(garbage(span), err)
// }
} }
} else { } else {
(garbage(span), err) (garbage(span), err)
@ -1995,6 +1998,7 @@ pub fn parse_block_expression(
output.signature = signature; output.signature = signature;
} else if let Some(last) = working_set.delta.scope.last() { } else if let Some(last) = working_set.delta.scope.last() {
// FIXME: this only supports the top $it. Instead, we should look for a free $it in the expression. // FIXME: this only supports the top $it. Instead, we should look for a free $it in the expression.
if let Some(var_id) = last.get_var(b"$it") { if let Some(var_id) = last.get_var(b"$it") {
let mut signature = Signature::new(""); let mut signature = Signature::new("");
signature.required_positional.push(PositionalArg { signature.required_positional.push(PositionalArg {

View File

@ -34,7 +34,7 @@ pub enum SyntaxShape {
GlobPattern, GlobPattern,
/// A block is allowed, eg `{start this thing}` /// A block is allowed, eg `{start this thing}`
Block, Block(Vec<(Vec<u8>, SyntaxShape)>),
/// A table is allowed, eg `[[first, second]; [1, 2]]` /// A table is allowed, eg `[[first, second]; [1, 2]]`
Table, Table,