Commit Graph

1923 Commits

Author SHA1 Message Date
John McCall
05459eced0 Add a convenience method for checking whether two types are
equivalent.



Swift SVN r729
2011-09-24 03:34:15 +00:00
John McCall
c61c807589 Mangle types for all declarations. Save the names of modules and mangle
those in, too.



Swift SVN r713
2011-09-18 09:21:42 +00:00
Chris Lattner
77237852d2 implement a.x syntax for using elements of a protocol.
Swift SVN r704
2011-09-11 17:39:45 +00:00
John McCall
54ff2ccf4a Lop the last word off ModuleDecl and TranslationUnitDecl.
Swift SVN r693
2011-09-06 21:43:46 +00:00
Chris Lattner
f2ae02a7b2 switch a couple of files to use AST.h umbrella header. Swift eagerly awaits clang modules...
Swift SVN r691
2011-09-06 07:01:03 +00:00
John McCall
ccb2d4e98f Framework for builtin lookup.
Swift SVN r685
2011-09-03 06:51:34 +00:00
Chris Lattner
0090c43b80 all members of a protocol have to be NamedDecl's, tighten up
typing.  Various tidying up.


Swift SVN r678
2011-09-02 00:58:38 +00:00
Chris Lattner
34ec8bc4aa implement support for var members of protocols.
Swift SVN r672
2011-09-01 21:57:35 +00:00
Chris Lattner
a838f412f4 eliminate ProtocolFuncElementDecl, just use FuncDecl instead.
Swift SVN r668
2011-09-01 18:17:12 +00:00
Chris Lattner
70bbb65241 make ProtocolType a DeclContext, add AST and trivial sema support for
ProtocolFuncElementDecl, the first thing we will allow in a protocol.


Swift SVN r664
2011-08-31 23:31:42 +00:00
Chris Lattner
cd66133b48 simplify interface to OneOfType::getNew.
Swift SVN r663
2011-08-31 23:11:05 +00:00
Chris Lattner
74b804a03a rearrange DeclContext arguments so that they are at the end, not the beginning.
Swift SVN r661
2011-08-31 23:05:51 +00:00
John McCall
6dfa91282d 'float' -> 'float32', 'double' -> 'float64'
Swift SVN r654
2011-08-31 19:57:52 +00:00
Chris Lattner
f9b024adb0 implement parser and AST support for trivial (empty) protocol types.
Swift SVN r652
2011-08-31 19:43:06 +00:00
John McCall
58b81c8da0 Add builtin float and double types.
Swift SVN r650
2011-08-31 18:43:22 +00:00
John McCall
b2bd8e12a7 Introduce the idea of a DeclContext.
Swift SVN r623
2011-08-25 19:26:50 +00:00
Chris Lattner
b04c19e647 introduce a enw AST/AST.h umbrella header and use it to
simplify #includes.



Swift SVN r578
2011-08-22 21:02:44 +00:00
Chris Lattner
1dc200c973 introduce an official ErrorType. This is to be used when a type is incorrectly
constructed.  When put on a decl, this should cause all uses of the decl to 
collapse away into badness during type checking.


Swift SVN r514
2011-08-12 05:42:20 +00:00
Chris Lattner
10f5c2fc66 remove the UnresolvedType, representing it with a null Type() instead. There is no need to
have two different ways to represent the same thing.  This has the pleasant bonus that stuff
crashes when you do things with unresolved types.


Swift SVN r513
2011-08-12 05:19:52 +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
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
dc32e37ac5 enable c++'0x for the makefiles and adopt it in a trivial case.
Swift SVN r433
2011-07-23 20:15:04 +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
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
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
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
fd2bf74f06 Move getCanonicalType from being a method on ASTContext to being a method on Type.
Swift SVN r314
2011-03-22 05:23:51 +00:00
Chris Lattner
44ac12cb21 Remove some old code, add an assert to get an assert instead of null pointer deref on invalid call.
Swift SVN r268
2011-03-14 23:39:13 +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
40d4fedcb8 Make it invalid to call getCanonicalType before name binding is fully completed. This *will* cause assertion failures on valid code at this point because too much sema stuff happens at parse time.
Swift SVN r253
2011-03-02 08:02:44 +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
dd2e2d8df3 Introduce UnresolvedType, make ASTContext have the singleton, update getCanonicalType to do the "right" thing.
Swift SVN r239
2011-02-26 02:33:52 +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
50b3fcc3d1 Switch TupleType to hold its elements with an llvm::ArrayRef instead of manually doing it.
Swift SVN r235
2011-02-22 07:15:54 +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
2e26241a7a Fix AliasType to point to the TypeAliasDecl instead of replicating its contents.
Swift SVN r229
2011-02-22 06:11:48 +00:00
Chris Lattner
93eea9c8bc Simplify ASTContext's transforming of NamedTypeDecls into types. It now doesn't unique them, the decls do for themselves. ASTContext still has the type symbol table.
Swift SVN r228
2011-02-22 06:07:32 +00:00
Chris Lattner
818cd27748 Implement tuple to tuple conversions that involve default element values.
Swift SVN r221
2010-11-27 17:17:57 +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
6f7564235d Wire up sema support for creating array types.
Swift SVN r207
2010-10-17 13:12:47 +00:00
Chris Lattner
ff38a2db1b AST Support for arrays.
Swift SVN r206
2010-10-17 12:56:04 +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