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
c827cc11a0
tidy up visitor, UnresolvedDotExpr base cannot be null since John's rework.
...
Swift SVN r584
2011-08-23 00:39:47 +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
624efc8491
introduce a new ApplyExpr class, and make it the parent class of CallExpr,UnaryExpr,BinaryExpr.
...
Swift SVN r579
2011-08-22 21:11:37 +00:00
Chris Lattner
b04c19e647
introduce a enw AST/AST.h umbrella header and use it to
...
simplify #includes.
Swift SVN r578
2011-08-22 21:02:44 +00:00
Chris Lattner
f03486e991
diagnose a bunch of problem cases with operators.
...
Swift SVN r575
2011-08-20 01:29:00 +00:00
Chris Lattner
28f05f0348
add parser and sema support for user defined unary operators.
...
Swift SVN r572
2011-08-20 00:27:11 +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
John McCall
dc31882541
Incorporate notes into the pattern-matching manifesto. A few more random
...
observations that weren't brought up during the meeting.
Swift SVN r567
2011-08-17 08:29:32 +00:00
Chris Lattner
b8fd157450
rip out the dead "isPrecededByIdentifier" logic from the AST and Lexer.
...
Swift SVN r529
2011-08-12 21:36:25 +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
John McCall
9f2ca5e4cc
Remove juxtaposition handling from the type-checker and put it
...
in the parser. Implement the grammar which permits this.
Enforce that binary operators have to, well, operators.
Swift SVN r515
2011-08-12 05:49:30 +00:00
Chris Lattner
1dc200c973
introduce an official ErrorType. This is to be used when a type is incorrectly
...
constructed. When put on a decl, this should cause all uses of the decl to
collapse away into badness during type checking.
Swift SVN r514
2011-08-12 05:42:20 +00:00
Chris Lattner
10f5c2fc66
remove the UnresolvedType, representing it with a null Type() instead. There is no need to
...
have two different ways to represent the same thing. This has the pleasant bonus that stuff
crashes when you do things with unresolved types.
Swift SVN r513
2011-08-12 05:19:52 +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
9279ebe82b
add Decl visition to ExprStmtVisitor.h, switch Decl.cpp to print the same way
...
expr and stmt does.
Swift SVN r470
2011-07-31 20:38:13 +00:00
Chris Lattner
93ac2b3cb9
rename FuncExpr to LambdaExpr.
...
Swift SVN r468
2011-07-31 20:15:56 +00:00
Chris Lattner
a8e2788184
implement semantic analysis for FuncExpr and have the parser lower func decls
...
to func exprs. All the tests pass again. Now we have a strict equality
between:
func foo(a : int) -> int { a+1 }
and
var foo = func(a : int) -> int { a+1 }
except we don't support the later syntax yet. We also really need return, though
we're getting closer to being able to usefully support it.
Swift SVN r466
2011-07-31 19:33:27 +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
c739c7955a
fit in 80 cols
...
Swift SVN r456
2011-07-31 01:20:16 +00:00
Chris Lattner
4071deceb1
update whitepaper for new syntax.
...
Swift SVN r445
2011-07-24 21:19:22 +00:00
Chris Lattner
0fc77abf5c
Per discussion on swift-dev, unify 'meth' and 'func' syntax into just 'func' syntax
...
where you can optionally declare a receiver type. This is cleaner both conceptually
and in implementation, and eliminates drug references. :)
Swift SVN r444
2011-07-24 20:11:35 +00:00
Chris Lattner
6f7c702321
disable copy and assignment of various types, and plain 'operator new' of others
...
using the new '0x way.
Swift SVN r443
2011-07-24 19:33:27 +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
f3c270fa06
convert DeclKind to an scoped enum
...
Swift SVN r439
2011-07-24 18:44:56 +00:00
Chris Lattner
f114a7ab79
close some declarations with shift right, adopting another killer '0x feature :)
...
Swift SVN r436
2011-07-24 00:37:18 +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
4f29cc0e8c
convert TheUnresolvedType/TheDependentType and the empty tuple type
...
to be accessors on their respective classes, for consistency.
Swift SVN r429
2011-07-19 06:41:42 +00:00
Chris Lattner
c9ec409046
Context.getNewOneOfType -> OneOfType::getNew
...
Swift SVN r428
2011-07-19 06:28:36 +00:00
Chris Lattner
a39857ab85
migrate ASTContext::getTupleType -> TupleType::get
...
Swift SVN r427
2011-07-19 06:26:55 +00:00
Chris Lattner
649a577059
move from ASTContext::getArrayType -> ArrayType::get
...
Swift SVN r426
2011-07-19 06:22:04 +00:00
Chris Lattner
e106d336cb
while I'm in a cleanup mood, move the factory functions from
...
types off of ASTContext onto the types themselves. This
never made sense for clang, and makes the same amount of sense
for swift. Start with function types.
Swift SVN r425
2011-07-19 06:17:26 +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
7275ca527a
pull in StringRef and Twine.
...
Swift SVN r422
2011-07-19 06:00:20 +00:00