[IMP] Handle lambdas and other missing expressions#559
[IMP] Handle lambdas and other missing expressions#559mmahrouss wants to merge 1 commit intoalpha-references-fdafrom
Conversation
dee8e85 to
5be75f8
Compare
| if is_in_validation { | ||
| diagnostics.extend(diags); | ||
| } | ||
| } |
There was a problem hiding this comment.
I don't know if we would gain a lot with that, but maybe we could bring back the break if not in validation?
if is_in_validation {
//
} else if !all_values {
break;
}There was a problem hiding this comment.
Yes, I could do that
| } | ||
| }}, | ||
| ExprOrIdent::Expr(Expr::Await(await_expr)) =>{ | ||
| let (evaluations, diags) = Evaluation::eval_from_ast(session, &await_expr.value, parent.clone(), max_infer, false, required_dependencies); |
There was a problem hiding this comment.
why don't you check for is_in_validation here?
There was a problem hiding this comment.
Because I am actually using the evaluation in an await expression, it can be used somewhere.
| // It needs adding a new function, ast_indexes, then add the variable inside | ||
| // I deem it currently unnecessary | ||
| Expr::Lambda(lambda_expr) => { | ||
| let sym = self.sym_stack.last().unwrap().borrow_mut().add_new_function( |
There was a problem hiding this comment.
this is unfortunately not perfectly right. As you create a 'lambda' function in the tree, it makes this symbol available later, so we could validate
a = lambda x: 5
print(lambda)Even if syntax is ofc invalid, it means that this lambda function is available in the scope. And we have nothing that prevent using a reserved keyword in the scope. But I agree it will work in normal cases.
There was a problem hiding this comment.
but it is "<lambda>", so it would not be present in any python code, no ?
5be75f8 to
3d888c9
Compare
No description provided.