mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Initial implementation of unformed state for local variables. (#1387)
Allows unformed state for local variables. Reports a run-time error when an unformed local variable is used. - Added declaration without initialization for local variables in the parser. - Made the init expression of VariableDefinition optional. - Expanded (alive, dead) to (uninitialized, alive, dead) in the Heap. Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
04cfcc1dc2
commit
52ee050019
@@ -53,7 +53,11 @@ void Statement::PrintDepth(int depth, llvm::raw_ostream& out) const {
|
||||
if (var.is_returned()) {
|
||||
out << "returned ";
|
||||
}
|
||||
out << "var " << var.pattern() << " = " << var.init() << ";";
|
||||
out << "var " << var.pattern();
|
||||
if (var.has_init()) {
|
||||
out << " = " << var.init();
|
||||
}
|
||||
out << ";";
|
||||
break;
|
||||
}
|
||||
case StatementKind::ExpressionStatement:
|
||||
|
||||
Reference in New Issue
Block a user