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
91f5abd1e9
Implement parser support for assignment, what a hack :-)
...
Swift SVN r166
2010-09-18 17:26:01 +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
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
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
cbecebb18d
-ast-dump shouldn't crash on empty identifiers
...
Swift SVN r153
2010-08-05 22:40:48 +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
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
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
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
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
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
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
Chris Lattner
9107a90d55
add support for representing dependent types.
...
Swift SVN r117
2010-07-30 18:18:28 +00:00
Chris Lattner
667078650a
Implement support for anonymous closure arguments. For example, we can now compile this:
...
var func6 : ((int,int) -> int) -> (); // Takes a function, returns nothing.
func funcdecl5() {
func6(_0 + _1); // Closure with two named anonymous arguments
}
into:
(apply_expr type='()'
(declref_expr type='(int, int) -> int -> ()' decl=func6)
(closure_expr type='(int, int) -> int'
(anondecl '_0' type='int')
(anondecl '_1' type='int')
(tuple_expr type='int'
(binary_expr '+' type='int'
(declref_expr type='int' decl=_0)
(declref_expr type='int' decl=_1))))))))
However, there are still some problems with this (and we're definitely not doing type inference yet, all anon args are assumed 'int').
Swift SVN r111
2010-07-28 06:25:16 +00:00
Chris Lattner
9d33ef3616
add infrasturctuer for binding to "named anonymous" arguments.
...
Swift SVN r108
2010-07-27 21:37:29 +00:00
Chris Lattner
874421d4ce
Implement AST and Sema support for auto-closures. We now parse:
...
var closure1 : () -> int = 4; // Function producing 4 whenever it is called.
var closure2 : (int,int) -> int = 4; // Has some (dead) arguments.
into:
(vardecl 'closure1' type='() -> int'
(closure_expr type='() -> int'
(integer_literal type='int' value=4)))
(vardecl 'closure2' type='(int, int) -> int'
(closure_expr type='(int, int) -> int'
(integer_literal type='int' value=4)))
Swift SVN r101
2010-07-27 06:27:02 +00:00
Chris Lattner
8562512be0
test commit
...
Swift SVN r97
2010-07-27 05:39:40 +00:00
Chris Lattner
da8a6af90a
add a new expression to model sequences instead of hacking up braceexpr to do it.
...
Swift SVN r94
2010-07-25 23:22:29 +00:00
Chris Lattner
a6b810b3e6
Enforce type rules in SemaExpr::ActOnBinaryExpr, validating that proper types are passed into the LHS/RHS of the operator.
...
Swift SVN r92
2010-07-25 23:04:03 +00:00
Chris Lattner
fa78da101b
implement lazy construction of canonical types, ala clang. This only affect tuples at the moment, but will affect type aliases someday.
...
Swift SVN r90
2010-07-25 22:41:05 +00:00
Chris Lattner
7e0123c768
Kill off add/sub/mul/div as special AST nodes. Instead, + is just yet-another identifier token and BinaryExpr is a generalized infix call expression.
...
Swift SVN r88
2010-07-25 19:16:45 +00:00
Chris Lattner
12fa92e146
Add a new ApplyExpr expression AST node for function application.
...
Swift SVN r85
2010-07-25 05:37:45 +00:00
Chris Lattner
9b42d1b273
enhance parenexpr to be tupleexpr. The grouping paren case is just a special case of a tuple literal with one child.
...
Swift SVN r81
2010-07-24 21:24:44 +00:00
Chris Lattner
2bafb0e8fb
Introduce new NamedDecl and FuncDecl classes. The difference between the two is syntactic sugar, so most clients want NamedDecl. This doesn't implement FuncDecl yet, which isn't a high prio for me in the short term.
...
Swift SVN r77
2010-07-24 19:09:09 +00:00
Chris Lattner
64ecbb8a9c
Implement AST and trivial Sema support for brace expressions.
...
Swift SVN r70
2010-07-23 19:39:51 +00:00
Chris Lattner
58185415a1
now that we have name lookup, we can implement references to
...
other values. crazzay.
Swift SVN r67
2010-07-23 05:48:20 +00:00
Chris Lattner
ed1be4f17a
add printing support for Identifier, switch VarDecl to have an
...
identifier instead of a stringref.
Swift SVN r63
2010-07-23 03:50:09 +00:00
Chris Lattner
8bf327b648
add a new AST/Identifier class which represents a uniqued string.
...
Add support to ASTContext to unique strings into identifiers.
Swift SVN r62
2010-07-23 03:40:02 +00:00
Chris Lattner
a860fe44db
implement support for printing types, add them to -ast-dump
...
Swift SVN r58
2010-07-22 06:33:03 +00:00
Chris Lattner
34602d5d22
Make Expr::Kind public.
...
Swift SVN r57
2010-07-22 06:10:31 +00:00
Chris Lattner
d6c8f0b621
make the AST representation of void just be ().
...
Swift SVN r53
2010-07-22 05:49:57 +00:00
Chris Lattner
fba7359c9c
eliminate a #include from ASTContext.h
...
Swift SVN r52
2010-07-22 05:47:33 +00:00
Chris Lattner
842821d541
add FunctionType, have sema create it and have ASTContext
...
unique it.
Swift SVN r51
2010-07-22 05:44:17 +00:00
Chris Lattner
c363b58ea1
Introduce TupleType, an AST representation of tuples.
...
Swift SVN r49
2010-07-22 01:58:01 +00:00
Chris Lattner
f7c8e53359
implement isa/dyncast and dumping support for exprs.
...
We can now parse and print this:
var x3 = 4+5*4+12/97;
into:
(vardecl 'x3'
(binary_expr
(binary_expr
(integer_literal 4)
(binary_expr
(integer_literal 5)
(integer_literal 4)))
(binary_expr
(integer_literal 12)
(integer_literal 97))))
Swift SVN r46
2010-07-19 06:52:08 +00:00
Chris Lattner
547b2a8003
implement vardecl dumping and Casting.h support for decls.
...
Swift SVN r45
2010-07-19 06:39:56 +00:00
Chris Lattner
669c129ab0
introduce new ASTConsumer interface, have parser invoke methods
...
on it.
Swift SVN r41
2010-07-19 05:50:41 +00:00
Chris Lattner
2eeee5faca
give ASTContext a SourceMgr reference, add diagnostic hooks to SemaBase.
...
Swift SVN r39
2010-07-19 05:13:55 +00:00
Chris Lattner
340a7faa01
stub out Decl AST's.
...
Swift SVN r37
2010-07-19 04:59:13 +00:00