Commit Graph

28382 Commits

Author SHA1 Message Date
Chris Lattner
70bbb65241 make ProtocolType a DeclContext, add AST and trivial sema support for
ProtocolFuncElementDecl, the first thing we will allow in a protocol.


Swift SVN r664
2011-08-31 23:31:42 +00:00
John McCall
6dfa91282d 'float' -> 'float32', 'double' -> 'float64'
Swift SVN r654
2011-08-31 19:57:52 +00:00
Chris Lattner
f9b024adb0 implement parser and AST support for trivial (empty) protocol types.
Swift SVN r652
2011-08-31 19:43:06 +00:00
John McCall
58b81c8da0 Add builtin float and double types.
Swift SVN r650
2011-08-31 18:43:22 +00:00
Chris Lattner
26dfa97027 better QOI for invalid arguments, produce:
error: unexpected diagnostic produced: error: operators must have one or two arguments
func %%%() {}
^

instead of:
error: unexpected diagnostic produced: error: operators must be declared 'infix_left'
func %%%() {}
^



Swift SVN r648
2011-08-31 00:52:13 +00:00
Chris Lattner
fd4aefa837 rename the infix attribute to infix_left.
Swift SVN r647
2011-08-31 00:32:15 +00:00
Chris Lattner
af4d36f463 Eliminate the 'unary' attribute, instead just know that operators
that take a single argument are unary.  Move a bunch of semantic
checking of operators from the parser to TypeCheckDecl now that it
has a decent place to hold it.


Swift SVN r646
2011-08-31 00:13:57 +00:00
Chris Lattner
b00ad81340 remove dead prototype
Swift SVN r645
2011-08-30 23:36:12 +00:00
Chris Lattner
01ea4fc173 fix a fixme by using ErrorType to potentially improve e rror recovery
Swift SVN r644
2011-08-30 23:35:16 +00:00
Chris Lattner
dc257f951c refactor decl checking logic into a DeclVisitor.
Swift SVN r643
2011-08-30 23:34:40 +00:00
Doug Gregor
63ca527a95 Introduce accessors into DeclVarName and eliminate direct mutation by
setting all fields on construction. Use this opportunity to save a
pointer of storage for every DeclVarName.
squeeze out a pointer's worth of storage


Swift SVN r639
2011-08-29 19:59:33 +00:00
Chris Lattner
dfa2e0719c move decl type checking out to TypeCheckDecl.cpp
Swift SVN r635
2011-08-26 23:28:44 +00:00
Chris Lattner
c135a64d33 eliminate checkBody now that it is just an ugly wrapper around
typeCheckExpression.  Change typeCheckExpression to mutate its
argument.


Swift SVN r634
2011-08-26 23:23:24 +00:00
Chris Lattner
e89a22ada9 now that typeCheckExpression is our main entry point for expr type checking,
have it do "completeness" checking (also fixing some regressions I introduced
along the way).  Exprs are now modularly checked, woo!



Swift SVN r633
2011-08-26 20:57:02 +00:00
Chris Lattner
161b2c83d5 make typeCheckExpression take an optional "convert to type" which comes from context,
simplifying a bunch of code.


Swift SVN r632
2011-08-26 20:53:09 +00:00
Chris Lattner
a0a7c2ac36 fix the expression type checker to not recurse down into statements, resolving some type checking issues.
Swift SVN r631
2011-08-26 00:48:33 +00:00
Chris Lattner
d7c0076b2f finish up sema of 'return', force converting the returned expression to the return type of the enclosing func.
Swift SVN r629
2011-08-26 00:24:35 +00:00
Chris Lattner
e0ce01906e split type validation out to its own .cpp file.
Swift SVN r628
2011-08-26 00:11:24 +00:00
Chris Lattner
2020470195 rip statement checkout out of the expr checker, allowing us to
enable checking of top level var decls etc.


Swift SVN r625
2011-08-25 23:33:30 +00:00
Chris Lattner
cbd84c3f73 split statement type checking out to its own file, detangling some stuff from Expr checking.
More to be done.


Swift SVN r624
2011-08-25 19:58:04 +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
ea63f11a7b move expression type coercion out to TypeCheckCoercion,
and change terminology to follow that which is understood by
other people.


Swift SVN r590
2011-08-23 19:53:11 +00:00
Chris Lattner
43aae84ae5 pull SemaTupleExpr into the TypeChecker class.
Swift SVN r589
2011-08-23 19:48:37 +00:00
Chris Lattner
aae5e303c1 inline SemaDeclRefExpr into its only call site.
Swift SVN r588
2011-08-23 19:47:06 +00:00
Chris Lattner
dfbb6b1c91 move "bottom-up" type checking into TypeCheckExpr.cpp, and
change terminology to follow directionality that other people
find more natural.


Swift SVN r587
2011-08-23 19:45:31 +00:00
Chris Lattner
63cd4a9566 sketch out the new type checking organization.
Swift SVN r586
2011-08-23 19:20:22 +00:00
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