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
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
9e8c82435a
implement AST and sema support for methods. The example method in the
...
testcase now AST's to:
(methdecl 'print2' type='(this : rect) -> (os : ostream) -> ()'
(closure_expr type='(this : rect) -> (os : ostream) -> ()'
(closure_expr type='(os : ostream) -> ()'
(brace_expr type='()'
(apply_expr type='int'
(declref_expr type='(r : rect) -> int' decl=area)
(tuple_expr type='(r : rect)'
(declref_expr type='rect' decl=this)))))))
which seems right. Some cleanups are pending.
Swift SVN r416
2011-07-19 05:26:51 +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
de094d7cde
Introduce i1/i8/i16/i64 types, and switch int to be 64-bit.
...
Swift SVN r390
2011-05-31 03:48:36 +00:00
Chris Lattner
79ba41c1fe
add a specialization of AllocateCopy to help out argument deduction a bit,
...
simplifying some code.
Swift SVN r385
2011-04-29 07:18:11 +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
687bb2c8ce
Move the getTupleFieldForScalarInit helper function out of TypeChecking.cpp into TupleType::getFieldForScalarInit.
...
Simplify the code handling conversion of grouping parens, and other minor cleanups. No functionality change.
Swift SVN r378
2011-04-28 23:10:55 +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
da28ba8072
Completely disable equality comparisons of Type.
...
Swift SVN r355
2011-04-10 06:30:57 +00:00
Chris Lattner
936f3654c9
Implement equality testing (ignoring sugar) for types.
...
Implement simple context sensitive type inference for overload sets.
Swift SVN r352
2011-04-10 06:06:53 +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
e071e0f159
add a helper, tweak a comment.
...
Swift SVN r347
2011-04-10 03:07:32 +00:00
Chris Lattner
ea53191985
properly initialize an ivar.
...
Swift SVN r346
2011-04-09 21:16:41 +00:00
Chris Lattner
55f553305e
Disallow comparison of Type's. You can still compare type pointers if you know what you're doing.
...
Swift SVN r344
2011-04-05 01:12:20 +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
7530ec988c
Add a error to reject foo() when foo is not a function type. Previously we allowed it because these are two valid top-level values, but we now reject them because they are almost certainly a bug. This can be disabled by putting a space between them if this is useful for some reason.
...
Swift SVN r339
2011-03-27 02:56:47 +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
b1ea095995
Factor a OneOf predicate into a helper method.
...
Swift SVN r331
2011-03-23 06:28:09 +00:00
Chris Lattner
c9ee19e269
Implement parser, sema, doc, and name lookup support for refined import declarations. You can still only do top level references, but that's because we don't have namespaces or anything else interesting yet.
...
This allows "import swift.int" for example.
Swift SVN r329
2011-03-23 05:18:29 +00:00
Chris Lattner
a93a1f640b
Rearrange some cases, only try to-tuple conversion if a tupleexpr isn't a grouping paren.
...
Swift SVN r315
2011-03-22 05:42:30 +00:00