mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Make assignment an expression.
Change AssignStmt into AssignExpr; this will make assignment behave more consistently with assignment-like operators, and is a first step toward integrating '=' parsing with SequenceExpr resolution so that '=' can obey precedence rules. This also nicely simplifies the AST representation of c-style ForStmts; the initializer and increment need only be Expr* instead of awkward Expr*/AssignStmt* unions. This doesn't actually change any user-visible behavior yet; AssignExpr is still only parsed at statement scope, and typeCheckAssignment is still segregrated from the constraint checker at large. (In particular, a PipeClosureExpr containing a single assign expr in its body still doesn't use the assign expr to resolve its own type.) The parsing issue will be addressed by handling '=' during SequenceExpr resolution. typeCheckAssignment can hopefully be reworked to work within the constraint checker too. Swift SVN r5500
This commit is contained in:
@@ -276,7 +276,7 @@ namespace {
|
||||
return checkLValue(Dest->getType(), "LHS of assignment");
|
||||
}
|
||||
|
||||
void verifyChecked(AssignStmt *S) {
|
||||
void verifyChecked(AssignExpr *S) {
|
||||
Type lhsTy = checkAssignDest(S->getDest());
|
||||
checkSameType(lhsTy, S->getSrc()->getType(), "assignment operands");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user