Commit Graph

28404 Commits

Author SHA1 Message Date
Chris Lattner
ad0852d9c9 move the definition of the TypeChecker class out to its own private
header, in preparation for splitting up TypeChecking.cpp.


Swift SVN r585
2011-08-23 00:50:04 +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
bd357f9051 unify the binary operator logic too.
Swift SVN r583
2011-08-22 23:02:36 +00:00
Chris Lattner
49dd631c12 unify the UnaryExpr and CallExpr type checking logic.
Swift SVN r582
2011-08-22 22:58:07 +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
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
Chris Lattner
92051fd98e add a new Subsystems.h file to hold the entrypoints for various subsystems,
instead of smashing them into Parser.h, resolving some FIXME's.



Swift SVN r556
2011-08-13 22:43:17 +00:00
Chris Lattner
73a3f9d888 fix clients to not poke the Parser class directly.
Swift SVN r555
2011-08-13 22:38:20 +00:00
Chris Lattner
33f774f9b7 Rearrange a bunch of code for better layering: instead of Parser depending on Sema,
just move the Sema code into the Parser library.  There is no way to use one without
the other.  The library formerly known as Sema will get renamed.


Swift SVN r542
2011-08-13 21:06:10 +00:00
Chris Lattner
b40d2ce29e fix naming convention violations.
Swift SVN r536
2011-08-12 22:52:33 +00:00
Chris Lattner
2689efa63b have the error type squeltch type checking.
Swift SVN r535
2011-08-12 22:46:01 +00:00
Chris Lattner
0dcbc8a3e8 remove some code that is unreachable now that sequence exprs go away reliably.
Swift SVN r534
2011-08-12 22:26:29 +00:00
Chris Lattner
4e074b6bb0 fix some busted logic handling overload resolution, producing
a correct (but poor QoI) error about no candidates an ambiguity.


Swift SVN r533
2011-08-12 22:03:05 +00:00
Chris Lattner
0015b823fb When type checking :foo(), we should defer type checking for
"root to leaf" type checking instead of emitting an error.  This fixes
the test breakage from the big rework patch.


Swift SVN r531
2011-08-12 21:51:11 +00:00
Chris Lattner
09da5ddc0b restructure code for readability, no functionality change.
Swift SVN r530
2011-08-12 21:48:28 +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
51a01a0ee5 All the excess-exprs stuff is dead code, now that the parser decides
statement boundaries correctly.



Swift SVN r519
2011-08-12 06:19:44 +00:00
Chris Lattner
4814530f79 rework validateType to be more conventional: not updating types in place.
Swift SVN r516
2011-08-12 05:54:44 +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
452308129e fix a case where Sema installed a non-null type. This isn't needed, we like null types
coming out of the parser.


Swift SVN r512
2011-08-12 04:57:50 +00:00
Chris Lattner
9e6817b3cd implement lexer, parser, and dox support for while loops, everything is hooked up now.
Swift SVN r502
2011-08-11 20:47:33 +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
ba773ca617 make unbound sequences of expressions that are not in a BraceStmt be an error.
This makes (0 1) an error, since 0 is dead.



Swift SVN r489
2011-08-03 22:18:14 +00:00
Chris Lattner
6e872fe562 when type checking of a sequence expr has completed, if that sequence expr is in
a bracestmt context, inline the sequence into the brace.  No particular
behavior change other than an adapted AST.


Swift SVN r488
2011-08-03 21:58:32 +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
0265e3cbd1 make 'else if' a special case, disallowing things like "else ;".
Swift SVN r482
2011-08-02 21:31:31 +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
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
72260c7cad add name binding support for statements at top-level.
Swift SVN r461
2011-07-31 17:36:26 +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
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
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