summaryrefslogtreecommitdiffstats
path: root/source/slang/check.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/check.cpp')
-rw-r--r--source/slang/check.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index a3e061a3b..a79af3f37 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -1581,11 +1581,16 @@ namespace Slang
DeclVisitor::dispatch(stmt->decl);
}
- void visit(BlockStatementSyntaxNode *stmt)
+ void visit(BlockStmt* stmt)
{
- for (auto & node : stmt->Statements)
+ checkStmt(stmt->body);
+ }
+
+ void visit(SeqStmt* stmt)
+ {
+ for(auto ss : stmt->stmts)
{
- checkStmt(node);
+ checkStmt(ss);
}
}
@@ -2414,6 +2419,24 @@ namespace Slang
return appExpr;
}
+ //
+
+ RefPtr<ExpressionSyntaxNode> visit(AssignExpr* expr)
+ {
+ expr->left = CheckExpr(expr->left);
+
+ auto type = expr->left->Type;
+
+ expr->right = Coerce(type, CheckTerm(expr->right));
+
+ if (!type.IsLeftValue)
+ {
+ getSink()->diagnose(expr, Diagnostics::assignNonLValue);
+ }
+ expr->Type = type;
+ return expr;
+ }
+
//