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
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
3b80f42a0b
The condition of an expression is converted to a logic value with
...
convertToLogicValue, at least right now.
Swift SVN r395
2011-06-05 02:18:51 +00:00
Chris Lattner
b9e7823656
Implement lexing and parsing support for a proper if expression. There
...
is no AST building or typechecking support yet. Document the intended
semantics in LangRef. This is clearly subject to change, but is a starting
point.
Swift SVN r393
2011-06-05 02:03:48 +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
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
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
85579ef131
Inline a bunch of trivial SemaExpr routines into parser. No need for the additional indirection/layering.
...
Swift SVN r342
2011-04-04 23:41:44 +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
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
a1cf13d201
Switch ActOnTupleType to take an ArrayRef, simplifying it.
...
Swift SVN r311
2011-03-22 04:54:13 +00:00
Chris Lattner
1fda8dd71d
Fix a scoping problem with my recent "make oneof constructors have the right typealias name" patch.
...
Swift SVN r305
2011-03-21 22:56:00 +00:00
Chris Lattner
8f073c56d3
This went with the previous patch.
...
Swift SVN r299
2011-03-21 21:53:59 +00:00
Chris Lattner
c9eb885752
Introduce top-level expressions and simplify TranslationUnitDecl (and various things that hack on it) by making it hold a single BraceExpr instead of a list of exprs and decls.
...
Swift SVN r293
2011-03-20 06:59:37 +00:00
Chris Lattner
cb8884e832
Move error reporting for unresolved types from SemaDecl to NameBinding, where it should be. This requires enhancing TranslationUnitDecl to hold a list of unresolved types.
...
Swift SVN r290
2011-03-20 04:45:06 +00:00
Chris Lattner
6807ad7fb1
Move some type validity checking to SemaDecl::handleEndOfTranslationUnit, out of NameBinding.
...
Swift SVN r287
2011-03-19 06:41:26 +00:00
Chris Lattner
d23c2f26f3
Document and implement lexer and parser support for trivial import decls. No Sema/AST support yet.
...
Swift SVN r285
2011-03-18 22:52:48 +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
ca1b16b9df
Cleanup SemaExpr::ActOnDotIdentifier.
...
Swift SVN r275
2011-03-17 04:31:55 +00:00
Chris Lattner
c5506dc66e
Capture the structure of a declared VarName in the ast as DeclVarName.
...
Swift SVN r266
2011-03-14 21:54:21 +00:00
Chris Lattner
db236941d0
Check in a massive rewrite of how sema works for expressions in an effort to make way for separate parsing, name binding, type checking phases.
...
Highlights of this include:
1) most of SemaExpr is gone now, when parsing, all expressions are assigned null types.
2) the introduction of a new TypeChecking pass, which assigns types to expressions, and checks their constraints.
3) ElementRefDecl now properly stores an access path for what it is accessing, and ElementRefDecl's get added to the AST.
4) The parser is much much simpler for expressions now, it just collects lists of primary exprs into SequenceExprs unconditionally.
5) This means that formation of binary expressions, function application etc is now done by TypeChecking. This is actually simpler, though admittedly surprising.
6) This introduces a new -parse-dump mode which just parses but does not perform name binding or type checking.
I've been working on this for a while and it is still quite broken: it still doesn't handle anondecls at all, doesn't perform conversion checking for default tuple elements, has missing pieces of varname name binding etc. However, there is no reason to not crash land it now, it's not like I'm going to break anyone else.
Swift SVN r262
2011-03-13 21:52:03 +00:00
Chris Lattner
b3e5c55fbc
Change the parser methods to lower case to follow naming conventions.
...
Swift SVN r256
2011-03-06 23:28:17 +00:00
Chris Lattner
291967ceb0
Make ParseIdentifier do the string->identifier conversion, simplifying clients. no functionality change.
...
Swift SVN r250
2011-03-02 06:55:35 +00:00
Chris Lattner
61d62179ee
Improve consistency by pushing Identifiers into Sema instead of StringRefs.
...
Swift SVN r249
2011-03-02 06:50:13 +00:00
Chris Lattner
553e276139
Wire up support for completing types that are used but not yet defined!
...
Swift SVN r241
2011-03-01 07:25:51 +00:00
Chris Lattner
ffef30f2c3
Change name lookup of types to always succeed: if a type is used before it is defined, just cons up a new TypeAliasDecl for the unresolved type and return it. Diagnose these at the end of the translation unit instead of at their first use.
...
Swift SVN r240
2011-02-27 20:49:29 +00:00
Chris Lattner
80e1ae6104
Rework a bunch of stuff in the type system: now the *only* way to name a type is through a 'typealias' and there is no such thing as a OneOfDecl. Instead, we have OneOfType's, which are always anonymous. "oneof declarations" and "struct declarations" are now both just sugar.
...
This eliminates the NamedTypeDecl class (because there is now only one named type decl), eliminates OneOfDecl, renames AliasTypeDecl to NameAliasTypeDecl for good measure, and introduces OneOfType.
This preserves all existing syntax, and allows stuff like this:
func test6(checkboxenabled : oneof { Yep, Nope }) {
test6(:Yep)
}
Which is an anonymous oneof.
Swift SVN r237
2011-02-26 02:03:01 +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
f9673bb44a
Remove the type symbol table from ASTContext, using the scoped hash table in SemaDecl instead. We resolve a bunch of fixmes (types now give a "previous definition here" diag), remove weird mutating state from ASTContext, and allow us to have shadowed types.
...
Swift SVN r234
2011-02-22 07:02:00 +00:00
Chris Lattner
5a74864a71
Add a scoped hash table for type names to SemaDecl, make Scope push it along with the value scoped hash table.
...
Nothing is added to the type symtab yet though.
Swift SVN r232
2011-02-22 06:45:30 +00:00
Chris Lattner
6a1416b3b8
Revert my last patch. Instead of having a TypeScope and ValueScope, we'll just make Scope do both!
...
Swift SVN r231
2011-02-22 06:36:52 +00:00
Chris Lattner
e6f00fe1cc
Rename the Scope class to ValueScope
...
Swift SVN r230
2011-02-22 06:30:18 +00:00
Chris Lattner
cb9b1838a6
Introduce and create a new TypeAliasDecl for typealiases.
...
Swift SVN r227
2011-02-22 05:47:08 +00:00
Chris Lattner
1a97122ba0
Update to build with mainline LLVM.
...
Swift SVN r225
2011-02-04 06:24:41 +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
8234b6fd66
Add some sema for tuple elements which are specified with a default value. Still not used for conversions yet.
...
Swift SVN r219
2010-11-25 21:18:48 +00:00
Chris Lattner
28789d43d2
Resolve a fixme: use foo.$1 instead of foo.field1
...
Swift SVN r216
2010-11-11 23:04:29 +00:00
Chris Lattner
3bd8a85784
Fix weirdness in the lang spec by making $123 be a special type of implementation identifier token, handling it uniformly in the grammar in the few places that it is valid.
...
Swift SVN r215
2010-11-11 22:27:39 +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
6f8dd4cf32
add parser support for array indexes
...
Swift SVN r209
2010-10-17 14:15:33 +00:00
Chris Lattner
fd54c7f5a0
add parser support for array types, no sema or ast yet.
...
Swift SVN r205
2010-10-15 11:54:34 +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
43f2d1dfa5
wire up parser and basic sema support for scoped identifier expressions (X::Y).
...
Swift SVN r180
2010-10-09 23:01:17 +00:00
Chris Lattner
09a023c3cd
Now that we have simple user defined data types, remove the __builtin_else_hack type. woot.
...
Swift SVN r179
2010-10-09 22:06:13 +00:00
Chris Lattner
ac855b690b
Move ActOnTypeAlias to SemaDecl since a type alias *is* a decl that *installs* a type. Add some fixme's and rename some junk in ASTContext relating to the typemap. Diagnose redefinitions of named types. Install a typemap entry when a data declaration is defined.
...
We can now declare variables to be of data type.
Swift SVN r178
2010-10-09 22:01:25 +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