Commit Graph

24831 Commits

Author SHA1 Message Date
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
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
f92a3d56d7 Implement parser support for structs, improve datadecl dumping.
Swift SVN r192
2010-10-10 06:38:24 +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
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
10e3eacc83 Create a DataElementDecl to represent the elements of a data, and wire up sema support for creating them when the data is defined.
Swift SVN r181
2010-10-09 23:24:56 +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
9ba168ace5 Fix Alias uniquing to reuse the already-uniqued identifier object instead of being a string map. Make getAliasType fail if a redefinition happens and make getNamedType return datatype's as well.
Swift SVN r177
2010-10-09 21:30:56 +00:00
Chris Lattner
aefb083fed Make the DataType class, wire it into ASTContext.
Swift SVN r176
2010-10-09 21:11:27 +00:00
Chris Lattner
a43a8f27f5 Wire data decls up to -ast-dump. Fix some minor bugs exposed along the way.
Swift SVN r175
2010-10-09 20:46:10 +00:00
Chris Lattner
0ad8498114 declare DeclData and create it in sema.
Swift SVN r174
2010-10-09 20:40:19 +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
3ea5878390 add scafolding for sema of datas.
Swift SVN r172
2010-10-09 19:33:50 +00:00
Chris Lattner
ecdc8da738 add parser support for type specifiers in data descriptors.
Swift SVN r171
2010-10-09 18:58:18 +00:00
Chris Lattner
17c36aa749 add parser support for simple data declarations
Swift SVN r170
2010-10-09 18:42:54 +00:00
Chris Lattner
19e5390b78 twinify more diagnostics.
Swift SVN r168
2010-10-09 17:50:40 +00:00
Chris Lattner
1bef5bd648 Bertrand prefers $0 to _1 for anonymous closure arguments.
Swift SVN r165
2010-09-18 16:57:10 +00:00
Chris Lattner
29503975d2 Enhance juxtaposition binding handling to handle binary operators and functions in a more fine-grained way, allowing if/else to work without braces.
Swift SVN r163
2010-09-04 19:25:56 +00:00
Chris Lattner
d2abfde434 introduce a new builtin type to represent the result of the else binary operator (which is a temporary hack until we get user defined types).
Use it to define ife/else.  Fix some precedence/parsing bugs that implementing else exposed. 

Swift SVN r162
2010-08-08 22:37:56 +00:00
Chris Lattner
45610c0ecc rework func argument parsing to be more consistent across ->'s.
Swift SVN r161
2010-08-08 21:36:26 +00:00
Chris Lattner
d5f834512e Next step to allow use of named arguments: Create a new ArgDecl AST node, and have SemaDecl form them. We now correctly diagnose argument name redefinitions (though the diagnostic sucks because we don't have loc info)
Swift SVN r159
2010-08-07 20:25:05 +00:00
Chris Lattner
b927b55863 Finally get around to allowing *use* of a named incoming function argument. The first step is to set up a scope for them and walk the argument names, keeping track of access path info.
Swift SVN r158
2010-08-07 20:10:19 +00:00
Chris Lattner
025143611f implement support for tuple expressions with names specified for the elements.
Swift SVN r157
2010-08-07 06:51:12 +00:00
Chris Lattner
5afc6bdbd0 Add Type::getAs<> and support for minimally desugaring types. Start preserving more type sugar in the type conversion code.
Swift SVN r154
2010-08-05 23:05:54 +00:00
Chris Lattner
429ecb81da Finish ast and sema support for name binding elements of tuples in var decls.
Swift SVN r152
2010-08-05 22:22:22 +00:00
Chris Lattner
bf63029ecd rework tuple element parsing to not use ParseDeclVar, since tuple elements are fundamentally different. While we're at it, switch to an arguably more natural syntax for field elements, naming them with .x : type instead of var x : type
Swift SVN r150
2010-08-05 05:03:55 +00:00
Chris Lattner
34a1beac31 inline ParseTypeOrDeclVar and ParseExprOrDeclVar into their single callers and simplify the code around them.
Swift SVN r149
2010-08-05 04:42:13 +00:00
Chris Lattner
43a526f1f5 a step towards parsing richer names. I need to do some refactoring of var parsing before going further.
Swift SVN r148
2010-08-05 04:28:32 +00:00
Chris Lattner
c1294622bf Cleanup type stuff.
Swift SVN r147
2010-08-04 06:35:54 +00:00
Chris Lattner
e1e335610f int is no longer a keyword, it is a type alias for the new __builtin_int32_type type.
Swift SVN r146
2010-08-04 05:27:45 +00:00
Chris Lattner
69133a6ed2 now that we have type aliases, eliminate void as a keyword.
Swift SVN r145
2010-08-04 05:16:37 +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
8f86874c19 add parser support for typealiases, we have to be able to exercise the canonical type system somehow.
Swift SVN r143
2010-08-04 04:42:13 +00:00
Chris Lattner
f704c58c42 Two significant changes:
1. Change the representation of TupleType to contain TupleTypeElt structs instead of PointerUnion<Type*, NameDecl*>
 2. Change type canonicalization to not strip field names off tuples, and change type conversion logic to use canonical types again.

Also adds some stuff to the todo list, destined to never be short.

Swift SVN r141
2010-08-04 03:35:53 +00:00
Chris Lattner
807a82cd3d Resolve a fixme involving precedence of juxtaposition.
Swift SVN r140
2010-08-04 00:34:27 +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
6858e37cf2 implement a lot more semantic analysis for tuple conversions.
Swift SVN r136
2010-08-03 05:25:10 +00:00
Chris Lattner
1bb344c282 strength reduce our handling of dependent types. Now, you can't compose dependent types, there isn't a (dep, int) type, the whole tuple gets dependent type. This simplifies things a bit.
Swift SVN r134
2010-08-03 04:36:05 +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
c6499fe1ed Fixme patrol, clean some up.
Swift SVN r131
2010-08-01 07:09:40 +00:00
Chris Lattner
c2fdbb65c6 Tuple types with a single element are now valid. var x : (((int))); is now a triply nested tuple. To make this work, values are allowed to convert to tuples with one element.
Swift SVN r130
2010-08-01 07:02:05 +00:00
Chris Lattner
47afc23bac Expand lexer to cover a broader range of punctuators for function names. Add comparison functions to standard prolog.
Swift SVN r128
2010-08-01 05:58:41 +00:00
Chris Lattner
9b30ba0b2c refactor function body parsing+sema a bit.
Swift SVN r126
2010-08-01 04:55:49 +00:00
Chris Lattner
eae524427b start refactoring to allow bottom-up type inference with re-sema. Still much to be done.
Swift SVN r122
2010-07-30 23:03:23 +00:00
Chris Lattner
1a9f102090 switch expression printing over to use a visitor instead of hand rolled dispatch.
Swift SVN r120
2010-07-30 21:08:58 +00:00