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
0d9da2b967
Improve diagnostics for oneof decls by making the constructors for the elements use the named type for the oneof decl instead of the underlying (unnamed) oneof type.
...
Swift SVN r302
2011-03-21 21:55:46 +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
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
d6d92deeb7
Wire DiagnoseUnresolvedType back up and clean up handling of vardecls. This now causes us to explode on tuples with default values so temporarily remove the tests. This also causes us to reject more anondecl tests since those aren't (re)implemented yet.
...
Swift SVN r267
2011-03-14 22:16:50 +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
ddb760bf2b
Remove the concept of an ASTConsumer, add a new TranslationUnitDecl.
...
Swift SVN r255
2011-03-04 22:08:34 +00:00
Chris Lattner
abb710acaa
Minor code tidying + comments, add some expected error tests.
...
Swift SVN r252
2011-03-02 07:59:48 +00:00
Chris Lattner
bd4ccf1a55
Fix structs to require that their element type be a syntactic tuple. Rejecting the testcase.
...
Swift SVN r251
2011-03-02 07:11:34 +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
b233848006
Tidy up and clean up code and error recovery in the parser. Add some templated allocation functions to ASTContext to simplify clients.
...
Swift SVN r248
2011-03-02 06:15:52 +00:00
Chris Lattner
272d9e8dad
Propagate "there were errors in the input" out to the exit code of the swift app by adding a "HadError" bool to ASTContext.
...
Swift SVN r244
2011-03-01 07:59:53 +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
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
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
f6d7adc4cb
Parse tuple element types as value-specifier's, allowing them to have initializers. Sema isn't wired up yet though.
...
Swift SVN r218
2010-11-25 20:49:01 +00:00
Chris Lattner
bc616e9fcd
Split the initializer syntax from var decls out to their own 'value-specifier' production
...
Swift SVN r217
2010-11-25 17:00:34 +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
2653092ae5
Change the grammar for oneof elements to require a ':' make them more swift like and less ml like. Before we had:
...
oneof MaybeInt {
None,
Some int
}
Now we have:
oneof MaybeInt {
None,
Some : int
}
This resolves a fixme in the langref.
Swift SVN r214
2010-11-11 21:06:00 +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
2f0d96885a
Move field exprs to their own section in langref. Document subscript exprs. Still no sema support.
...
Swift SVN r210
2010-10-18 06:34:46 +00:00
Chris Lattner
6f8dd4cf32
add parser support for array indexes
...
Swift SVN r209
2010-10-17 14:15:33 +00:00
Chris Lattner
f66d7a6faf
Update langref for array types.
...
Swift SVN r208
2010-10-17 13:57:10 +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
d6862a7e5f
Fix decl-brace to not require ';'s
...
Swift SVN r204
2010-10-15 11:16:36 +00:00
Chris Lattner
154c0c6eb9
Resolve a fixme by eliminating the ; in func decls and making the grammar more restrictive.
...
Swift SVN r203
2010-10-15 11:07:49 +00:00
Chris Lattner
b9fbd77f58
Fix a bunch of minor bugs found through inspection:
...
1. Punctuation identifiers were missing some characters.
2. Some parser production and methods were misnamed.
3. Top level var decls don't need a ; after them.
4. Various parser comments were out of date.
5. We now allow any type in a struct decl, e.g. "struct foo int", even though it's weird.
Swift SVN r199
2010-10-12 07:24:33 +00:00
Chris Lattner
bb541a2f31
add a note.
...
Swift SVN r198
2010-10-11 21:18:15 +00:00
Chris Lattner
26e63c29ac
rip out a bunch of special case parsing logic for function arguments now that tuples have a sane syntax.
...
Swift SVN r197
2010-10-11 21:05:07 +00:00
Chris Lattner
0fcf9a4199
Bertand finally beat some sense into me, convincing me that tuples with named elements are more important than tuples with anonymous elements.
...
This changes the grammar for tuple type elements to be:
/// type-tuple-element:
/// identifier? ':' type
instead of:
/// type-tuple-element:
/// type
/// '.' identifier ':' type
In practice this means that you don't have to use things like (.x : int, .y : int) you can just use (x :int, y:int) which is what we already have for function argument lists.
Swift SVN r196
2010-10-11 21:00:55 +00:00
Chris Lattner
e9db331fa0
Struct declarations also inject their name into the global scope, allowing them to be used unqualified.
...
Swift SVN r193
2010-10-10 06:45:11 +00:00
Chris Lattner
f92a3d56d7
Implement parser support for structs, improve datadecl dumping.
...
Swift SVN r192
2010-10-10 06:38:24 +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
ad438c55e3
Implement the rest of sema for scoped identifier references (X::Y) we now get a proper DeclRefExpr, and this:
...
var def = DataSearchFlags::None;
-ast-dump's into:
(vardecl 'def' type='DataSearchFlags'
(declref_expr type='DataSearchFlags' decl=None))
Swift SVN r182
2010-10-09 23:46:16 +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