Commit Graph

444 Commits

Author SHA1 Message Date
Doug Gregor
a8de31b0e0 Implement Stmt::getSourceRange() along with proper implementations for
each of the subclasses.


Swift SVN r857
2011-11-10 00:46:07 +00:00
Doug Gregor
9995a39aae Switch Expr::getLoc() over to an implementation that defaults to the
starting location of the expression, but can be overridden by
subclasses.


Swift SVN r856
2011-11-10 00:34:40 +00:00
Doug Gregor
0223f3edf1 Implement Expr::getSourceRange() and introduce proper support for this
function into all of the expression nodes. Re-implement
Expr::getStartLoc() in terms of this function, and add it's brother
Expr::getEndLoc(), removing the specialized implementations.

Clean up the source ranges of implicitly-created tuple expressions in
the process.


Swift SVN r855
2011-11-10 00:25:48 +00:00
Chris Lattner
2dcaed352b tidy up
Swift SVN r812
2011-11-01 06:47:50 +00:00
Chris Lattner
3c43cae8b4 now that types can get their astcontext, remove some pointless argument passing.
Swift SVN r757
2011-10-18 23:25:42 +00:00
Chris Lattner
a7c7d64fa0 Switch swift to use SourceLoc instead of SMLoc.
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
2011-10-18 01:22:29 +00:00
John McCall
f121bd5e2d Arbitrary-associativity operator precedence parsing.
Swift SVN r743
2011-09-29 01:31:16 +00:00
John McCall
25ee366396 Add an lvalue-to-rvalue conversion AST node.
Swift SVN r742
2011-09-28 01:12:34 +00:00
John McCall
5249bc7a5b Metaprogram getLoc() and getStartLoc().
Swift SVN r741
2011-09-28 01:01:15 +00:00
John McCall
b2facdae4b Getterize Stmt.h.
Swift SVN r720
2011-09-20 07:07:53 +00:00
John McCall
b351394b6e Getterify the rest of Expr.h.
Swift SVN r719
2011-09-20 00:18:57 +00:00
John McCall
802262a7da More incremental getterization.
Swift SVN r718
2011-09-19 23:37:21 +00:00
John McCall
7a259f4bad Differentiate between the starting location and caret location of
an expression.  More incremental getterization.



Swift SVN r717
2011-09-19 22:45:58 +00:00
John McCall
02e47ed9ce Privatize Expr's Ty and Kind members; introduce getters and setters.
Swift SVN r716
2011-09-19 22:00:20 +00:00
Chris Lattner
8eaddc1cda AST support for floating point literals.
Swift SVN r707
2011-09-15 21:37:46 +00:00
Chris Lattner
77237852d2 implement a.x syntax for using elements of a protocol.
Swift SVN r704
2011-09-11 17:39:45 +00:00
John McCall
37b07c8691 Add builtin bindings for a bunch of primitive LLVM instructions.
Swift SVN r698
2011-09-08 00:21:11 +00:00
John McCall
4a0f713e62 Progress towards a builtin module.
Swift SVN r682
2011-09-03 05:35:49 +00:00
Chris Lattner
2711ad03c9 now that WalkOrder is in a common header, move the WalkStmt to be a
Stmt method, rename it to just 'walk' to follow the naming convention,
and give it an accurate doc comment for good measure.


Swift SVN r622
2011-08-25 18:24:54 +00:00
Chris Lattner
cb59d9c926 split the walkorder enum out to its own header file. This is a silly waste of
a file, but is needed to share it between two other heads.  Header files seem
so baroque.


Swift SVN r621
2011-08-25 18:18:22 +00:00
Chris Lattner
26cee15cf3 Switch expr walking functionality to take blocks instead of function pointer + void*.
Swift SVN r602
2011-08-25 00:51:31 +00:00
Chris Lattner
3e02267edf hoist the argument expression of Call/Unary/Binary up to ApplyExpr.
Swift SVN r581
2011-08-22 22:45:02 +00:00
Chris Lattner
035b65d407 change the representation of BinaryExpr to use an implicit tuple
to bind its LHS/RHS together, making it more similar to other ApplyExprs.


Swift SVN r580
2011-08-22 22:42:12 +00:00
Chris Lattner
4c9b8ecf11 add ast and sema support for unary operators. We need some serious AST refactoring
to unify our representation of calls, which I'll do later.


Swift SVN r570
2011-08-19 22:40:26 +00:00
Chris Lattner
414f2ae17b apply_expr -> call_expr
Swift SVN r528
2011-08-12 21:23:56 +00:00
John McCall
ddd134854e Rename ApplyExpr to CallExpr and change the signature of SemaCallExpr.
Swift SVN r523
2011-08-12 17:31:14 +00:00
Chris Lattner
ce6f6a83cd add AST support for WhileStmt. This isn't important, but is easy to add.
Swift SVN r501
2011-08-11 20:33:34 +00:00
Chris Lattner
433d6de807 implement AST and parser support for 'return'. We're still not doing a conversion
to a return type yet though.  We happily diagnose thigns like this as an error:

func foo() -> int {
  return 4 5
}



Swift SVN r493
2011-08-03 23:19:24 +00:00
Chris Lattner
c86e786ab5 switch langref to new func syntax, switch implementation to use FuncExpr instead of LambdaExpr.
Swift SVN r487
2011-08-03 00:32:15 +00:00
Chris Lattner
350b89e6e4 Represent assignments as their own AssignStmt, preserving the model we had
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
2011-08-01 17:45:21 +00:00
Chris Lattner
ebc33d306f add AST support for semicolon statements and clean up the parser. While noone cares, it is trivial
to support and good for completeness.


Swift SVN r475
2011-07-31 21:09:23 +00:00
Chris Lattner
fb8621f53a introduce DeclVisitor, ExprVisitor, and StmtVisitor template typedefs.
Swift SVN r472
2011-07-31 20:46:12 +00:00
Chris Lattner
d5523fa257 rename ExprStmtVisitor to ASTVisitor.
Swift SVN r471
2011-07-31 20:41:11 +00:00
Chris Lattner
93ac2b3cb9 rename FuncExpr to LambdaExpr.
Swift SVN r468
2011-07-31 20:15:56 +00:00
Chris Lattner
d232974df1 introduce a new FuncExpr AST node. No clients yet though.
Swift SVN r465
2011-07-31 18:10:24 +00:00
Chris Lattner
f7c873507b rename ExprVisitor to ExprStmtVisitor, since it can visit either kind.
Swift SVN r464
2011-07-31 17:46:16 +00:00
Chris Lattner
8148b8cd1d fix the expr side of the visitor to follow the naming convention.
Swift SVN r463
2011-07-31 17:43:47 +00:00
Chris Lattner
63ce0be641 make the big switch: {} are now statements, not expressions. This removes some
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
2011-07-31 17:39:13 +00:00
Chris Lattner
30b878c5d6 add support for walking statements properly, dissolving some hacks.
Swift SVN r459
2011-07-31 07:40:13 +00:00
Chris Lattner
382f33ec74 introduce statements, make if (and ;) a statement. This includes a
few horrible hacks, but is the right direction to go.


Swift SVN r457
2011-07-31 06:52:11 +00:00
Chris Lattner
3a059605e7 convert TypeKind and WalkOrder to scoped enums
Swift SVN r441
2011-07-24 19:24:55 +00:00
Chris Lattner
e122365134 switch ExprKind to be a scoped enum. This required renaming
IntegerLiteral to IntegerLiteralExpr, which is good for consistency anyway.


Swift SVN r440
2011-07-24 18:49:23 +00:00
Chris Lattner
096a3e16bc switch to range-based for loops where possible. I'm actually surprised how many
places are blocked by needing an index exposed for other purposes.  Not having a
MutableArrayRef doesn't help either.


Swift SVN r434
2011-07-23 20:47:13 +00:00
Chris Lattner
3af81cccbe raw_ostream and NullablePtr. While there are more types that
could be handled in similar ways, this gets the most of them.


Swift SVN r424
2011-07-19 06:09:31 +00:00
Chris Lattner
10017bef15 ArrayRef and SmallVector[Impl]
Swift SVN r423
2011-07-19 06:03:26 +00:00
Chris Lattner
19dbcaa171 pull the casting operators into LLVM.h
Swift SVN r421
2011-07-19 05:57:01 +00:00
Chris Lattner
e647b29339 stop the llvm-namespace-qualification-insanity by caving in and
adding a new swift/AST/LLVM.h file which forward declares and imports
common llvm classes, starting with SMLoc.


Swift SVN r420
2011-07-19 05:49:43 +00:00
Chris Lattner
464d255a2d Implement AST building and type checking for if expressions, these now work per-documentation, though the diagnostics are awful.
Swift SVN r397
2011-06-05 04:02:24 +00:00
Chris Lattner
0b068577bd Use TupleShuffleExpr to finally eliminate the last remenants of the
ASDAG.  Our AST is actually a tree again.  The testcase compiles into:
...
          (vardecl 'c' type='(a : int, b : int)')
          (vardecl 'd' type='(b : int, a : int)'
            (tuple_shuffle type='(b : int, a : int)' Elements=[1, 0]
              (declref_expr type='(a : int, b : int)' decl=c))))))



Swift SVN r387
2011-04-29 07:22:33 +00:00
Chris Lattner
56b3a5e6ab introduce a new TupleShuffleExpr expression kind, which will be used to eliminate the ASDAG.
Swift SVN r384
2011-04-29 07:10:32 +00:00