mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-25 14:10:11 +01:00
Add support for return; (#678)
This creates a ReturnExpression. A separate change should enforce that an implicit return of `()` is only allowed in functions that have an implicit return type of `()`, and I think the structure taken here should ease that.
This commit is contained in:
@@ -21,7 +21,10 @@ void FunctionDefinition::PrintDepth(int depth, llvm::raw_ostream& out) const {
|
||||
}
|
||||
out << "]";
|
||||
}
|
||||
out << *param_pattern << " -> " << *return_type;
|
||||
out << *param_pattern;
|
||||
if (!is_omitted_return_type) {
|
||||
out << " -> " << *return_type;
|
||||
}
|
||||
if (body) {
|
||||
out << " {\n";
|
||||
body->PrintDepth(depth, out);
|
||||
|
||||
Reference in New Issue
Block a user