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
Chris Lattner
6720390c84
Implement a first, very simple cut at ranking conversions for overload sets. This is important because we previously required exact type matching for overload resolution, and (int) != (.x : int) so no arguments with names would match up with anonymous values.
...
We still don't use ranking for binary operators etc.
Swift SVN r379
2011-04-29 00:14:20 +00:00
Chris Lattner
91fb8351b7
Implement support for overloaded binary operators.
...
Swift SVN r366
2011-04-11 05:59:23 +00:00
Chris Lattner
c3c602f9d3
Reimplement processing of dot expressions to have their base resolved as part of Type checking of SequenceExprs. This ensures that we can establish a proper base expression for the value.
...
Swift SVN r363
2011-04-11 05:20:21 +00:00
Chris Lattner
a6ccf69bc6
Implement support for overloading in .-style name lookup. This is not super useful yet because we don't have conversion ranking, but it's progress.
...
Swift SVN r356
2011-04-10 16:48:31 +00:00
Chris Lattner
3b4a8b03d2
1. With overloading in play, SemaDecl should never resolve unqualified lookup that hits at translation unit scope to a DeclRefExpr. Doing so can break overloading.
...
2. This exposed a bug: when parsing structs, we weren't adding all decls to the translation unit, we were just adding the type alias.
3. This exposed that TypeChecking wasn't handling OneOfElementDecl.
4. Introduce a new NLKind enum in NameLookup instead of passing around a bool.
5. Have unqualified lookup that returns an overload set form a new OverloadSetRefExpr, which has dependent type.
6. Enhance various stuff to handle OverloadSetRefExpr. It's still not fully handled yet though, so it can't be used for anything useful.
7. Change Expr.cpp to print types with << instead of T->print(OS) which is simpler and correct in the face of null.
Swift SVN r351
2011-04-10 05:57:10 +00:00
Chris Lattner
5e28a6fcdd
Finally get around to doing a major type system refactoring, where we introduce Type as a "smart pointer" and rename the existing Type class to TypeBase.
...
This prevents use of isa/dyn_cast/etc on Type*'s and means we just pass around Type by value instead of having to use Type* everywhere.
Swift SVN r343
2011-04-05 01:06:57 +00:00
Chris Lattner
5e2346492e
Implement basic "dot syntax" for applying functions to values. size.area now applies size to area when area is defined as a global function.
...
Swift SVN r341
2011-04-02 23:10:55 +00:00
Chris Lattner
ed7b06c6ff
Move semantic analysis of scoped identifiers (x::a) to typechecking, allowing forward referencing of types. This introduces a new UnresolvedScopedIdentifierExpr node to represent the unresolved form.
...
Swift SVN r334
2011-03-26 22:35:05 +00:00
Chris Lattner
6950fa6a2c
Improve expr dumping to not crash on null exprs, print the Arg# for anonexprs.
...
Swift SVN r300
2011-03-21 21:54:34 +00:00
Chris Lattner
3a57e3f661
Reimplement the SemaExpressionTree expression walking logic in terms of Expr->WalkExpr, which already has it. Enhance WalkExpr to allow skipping visitation of subtrees. No functionality change.
...
Swift SVN r279
2011-03-17 06:39:02 +00:00
Chris Lattner
6ab4eec127
Two changes that got mixed up:
...
#1 : Change type conversion errors to print the types involved, making the diagnostic better. We still don't have ranges, but it is progress.
#2 : Reimplement support for anonymous closure arguments (e.g. func($0+$1)) where func takes a closure, step #1 .
- This removes AnonDecl, replacing it with AnonClosureArgExpr. $0 and friends have to be expressions since they don't get a type and don't get resolved until TypeChecking.
- For now we just replace the existing broken support, a future step is to implement type checking support for them.
Swift SVN r278
2011-03-17 06:09:19 +00:00
Chris Lattner
71eb272b4a
Build AST nodes for references to unresolved names. These can be resolved after parse time.
...
Swift SVN r258
2011-03-07 00:12:38 +00:00
Chris Lattner
7bbe52b52a
Expand the swift language to allow typealiases, oneof, and struct within a brace expression. This allows us to have shadowing of type names.
...
Swift SVN r236
2011-02-22 07:41:44 +00:00
Chris Lattner
50b3fcc3d1
Switch TupleType to hold its elements with an llvm::ArrayRef instead of manually doing it.
...
Swift SVN r235
2011-02-22 07:15:54 +00:00
Chris Lattner
e488b69182
Implement sema support for TupleExprs with default elements (represented with null), implement support for conversions from scalar to tuples with multiple default elements.
...
Swift SVN r220
2010-11-25 23:02:23 +00:00
Chris Lattner
906ba908fd
Rename 'data' to 'oneof', resolving a fixme in the spec. Yay for CLU!
...
Swift SVN r212
2010-11-11 01:20:36 +00:00
Chris Lattner
6f7564235d
Wire up sema support for creating array types.
...
Swift SVN r207
2010-10-17 13:12:47 +00:00
Chris Lattner
bffee378d2
Generalize the expression walker to allow rewrites to be implemented.
...
Swift SVN r191
2010-10-10 06:19:16 +00:00
Chris Lattner
a885cd5dc5
Diagnose completely unresolved expressions with an error like this:
...
data.swift:114:10: error: ambiguous expression could not resolve a concrete type
var xx = :Zero;
^
Do this with a very general pre/post-order walking function.
Swift SVN r190
2010-10-10 06:11:47 +00:00
Chris Lattner
272cbcaba3
Implement parser, ast and minimal sema support for :foo expressions, type resolution isn't done yet.
...
Swift SVN r185
2010-10-10 00:15:46 +00:00
Chris Lattner
57c697172a
Split NamedDecl into NamedDecl with a ValueDecl subclass that has the type and value of the decl.
...
Swift SVN r173
2010-10-09 20:28:11 +00:00
Chris Lattner
91f5abd1e9
Implement parser support for assignment, what a hack :-)
...
Swift SVN r166
2010-09-18 17:26:01 +00:00
Chris Lattner
a8916a6106
implement semantic analysis and AST representation for AliasType (aka typedefs in C).
...
Swift SVN r144
2010-08-04 05:14:57 +00:00
Chris Lattner
04f7a08621
add support for tuple field access with ".", e.g.:
...
var a : (int, var f : int, int);
var b = a.field0+a.field1+a.f;
This also eliminates TupleConvertExpr.
Swift SVN r137
2010-08-03 06:55:08 +00:00
Chris Lattner
7a5b428772
start reworking tuple compatibility: two different tuples aren't compatible because their canonical type is the same, they are compatible because one can be converted to the other. I'm just going to rip out canonical type support for now.
...
Swift SVN r133
2010-08-03 04:17:26 +00:00
Chris Lattner
422da5de1f
Give _0 a dependent type and use type inference to determine what it is based on context. Still some "bottom up" type inference logic missing, and we don't infer all the types in the expression tree of things like:
...
func6((_0 4) + _0);
yet.
Swift SVN r121
2010-07-30 22:04:44 +00:00