Add assignment statements into the implicitly-defined default
constructor body to initialize all of the members appropriately, e.g.,
by calling the default constructor. For builtin types and class types,
introduce ZeroValueInitExpr to produce a "zero" value.
ZeroValueInitExpr still needs a representation in SIL. Until then,
actual generation of this AST is suppressed.
Swift SVN r4895
When the struct definition has no user-defined constructors, and there
is at least one instance variable, add an implicit default
constructor. This default constructor is currently empty; that's to be
fixed next.
Swift SVN r4868
Create a new FallthroughStmt, which transfers control from a 'case' or 'default' block to the next 'case' or 'default' block within a switch. Implement parsing and sema for FallthroughStmt, which syntactically consists of a single 'fallthrough' keyword. Sema verifies that 'fallthrough' actually appears inside a switch statement and that there is a following case or default block to pass control to.
SILGen/IRGen support forthcoming.
Swift SVN r4653
We use three tag bits on Expr*, Stmt*, Decl*, TypeBase* and SILTypeInfo*, and four on DeclContext*, so set the alignment of the pointed-to types formally with alignas(N) instead of relying on operator new passing down the right alignment to the allocator. Get rid of the informal T::Alignment members of these classes and pass alignof(T) to their allocators. Fix the 'operator new' of DeclContext subclasses so that we can actually use the four tag bits PointerLikeTypeTraits<DeclContext*> claims are available.
Swift SVN r4587
Implement switch statements with simple value comparison to get the drudge work of parsing and generating switches in place. Cases are checked using a '=~' operator to compare the subject of the switch to the value in the case. Unlike a C switch, cases each have their own scope and don't fall through. 'break' and 'continue' apply to an outer loop rather to the switch itself. Multiple case values can be specified in a comma-separated list, as in 'case 1, 2, 3, 4:'. Currently no effort is made to check for duplicate cases or to rank cases by match strength; cases are just checked in source order, and the first one wins (aside from 'default', which is branched to if all cases fail).
Swift SVN r4359
We have no intention of ever supporting actual semicolon statements
(separators, statements no), nor do we ever want to because that would
mean the behavior of the program would potentially change if semicolons
were naively removed.
This patch tracks the trailing semicolon now in the decl/expr/stmt,
which will enable someone to write a good "swift indent" tool in the
future.
Swift SVN r3824
implementing rdar://11360347 / 11349750. C-style for loops could be
further enhanced by allowing a comma-separated list of statements in
the increment, but this isn't something I plan to do in the short term.
Swift SVN r1713
Also use the new getAdvancedLoc() method instead of hacking
on SMLoc directly.
Also fix the warning/note/error methods to forward through ASTContext
instead of being replicated everywhere.
Swift SVN r750
before, but removing the hack where we'd represent them as a binary operator
with a null operator function. We still have no clear semantics for what
is valid or not.
Swift SVN r478
annoying things from the grammar (like expr-non-brace), and makes it so that
the body/else of an if is just a statement.
This patch has a fairly serious caveat that we just drop function bodies on the
floor now, since we have no "stmtexpr" sort of thing to represent the syntactic
sugar that is func. We'll fix that soon.
Swift SVN r462