diff options
Diffstat (limited to 'source/slang/slang-check-expr.cpp')
| -rw-r--r-- | source/slang/slang-check-expr.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index a00b1bea2..055364d5e 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -3769,6 +3769,32 @@ namespace Slang return CreateErrorExpr(expr); } + Expr* SemanticsExprVisitor::visitReturnValExpr(ReturnValExpr* expr) + { + auto scope = expr->scope; + if (scope) + { + auto parentFunc = as<CallableDecl>(getParentFunc(scope->containerDecl)); + if (parentFunc) + { + if (as<ErrorType>(parentFunc->returnType.type)) + { + expr->type = parentFunc->returnType.type; + return expr; + } + if (isNonCopyableType(parentFunc->returnType.type)) + { + expr->type.isLeftValue = true; + expr->type.type = parentFunc->returnType.type; + return expr; + } + } + } + getSink()->diagnose(expr, Diagnostics::returnValNotAvailable); + expr->type = getASTBuilder()->getErrorType(); + return expr; + } + Expr* SemanticsExprVisitor::visitAndTypeExpr(AndTypeExpr* expr) { // The left and right sides of an `&` for types must both be types. |
