Chris Lattner
173df8794d
implement the construction for MetaTypeType's and plug a leak of the ParenTypes map.
...
Swift SVN r1002
2012-01-11 06:59:14 +00:00
John McCall
d559794e73
Introduce a new kind of sugar, ParenType. A tuple with one
...
anonymous member is actually one of these.
A func decl is curried over all of its parameter clauses,
as long as they're written without parentheses. So the body
of a func is the body of the "most curried" function:
func foo(x:int) -> (y:int) -> int {
// This is the body of the function that takes 'y'.
// It returns an int.
}
func bar(x:int) -> ((y:int) -> int) {
// This is the body of the function that takes 'x'.
// It returns a functon of type (y:int) -> int.
}
Swift SVN r993
2012-01-06 04:10:32 +00:00
Chris Lattner
b737b112e7
modernize ProtocolType a bit to follow the form of OneOfType
...
Swift SVN r991
2012-01-05 21:51:48 +00:00
Chris Lattner
19b7a934a1
rename BuiltinFloatingPointType to BuiltinFloatType.
...
Swift SVN r980
2011-12-23 00:07:58 +00:00
Chris Lattner
c91c1d9db1
generalize builtin floating point types to support all of the FP types
...
that LLVM supports. The standard library still only exports float and double,
but the swift core should be more general. Yay for PPC128 :)
Swift SVN r973
2011-12-22 22:01:07 +00:00
Chris Lattner
6a51dbba34
Remove hard coded list of integer types from ASTContext, making BuiltinIntegerType have a "plus" factory method to create them like other types.
...
Swift SVN r966
2011-12-22 07:07:01 +00:00
Chris Lattner
98c5f5fad4
change BuiltinIntegerType to keep its width as an ivar, eliminating the
...
number of switches scattered through the compiler.
Swift SVN r964
2011-12-22 06:50:34 +00:00
Chris Lattner
6315b94e6b
split out integer types to their own subclass of BuiltinType.
...
Swift SVN r932
2011-12-14 21:49:08 +00:00
Chris Lattner
5f1f4d8ce9
simplify code in Parser::actOnOneOfType now that oneof's always have names.
...
Give OneOfType an ivar for its TypeAlias. It already knew its DeclContext.
Swift SVN r923
2011-12-13 01:41:19 +00:00
Chris Lattner
212b56afec
actually, the ASTStage should be on Translation unit. There can be multiple modules in a context and they can all be in different phases of translation.
...
Swift SVN r902
2011-12-06 00:51:56 +00:00
Chris Lattner
02c9d9a3f1
Make the AST "phase" part of ASTContext, this is generally useful for assertions.
...
Swift SVN r900
2011-12-06 00:32:00 +00:00
Chris Lattner
0ca79b1075
rename ASTContext::BuiltinModule -> TheBuiltinModule for consistency with
...
the other ASTContext members.
Swift SVN r799
2011-11-01 04:18:23 +00:00
Chris Lattner
8e1c6c8ac6
flatten ModuleKind discriminator into DeclContext's one. Now Module is an
...
abstract class and we have an actual AST-level concept of the builtin module.
Swift SVN r798
2011-11-01 04:07:57 +00:00
Chris Lattner
9298082ebb
move Diagnostics header to include/swift/AST to match .cpp files.
...
Swift SVN r782
2011-10-22 00:47:35 +00:00
Chris Lattner
f92f616aaf
remove hte ASTContext::hadError bool.
...
Swift SVN r778
2011-10-22 00:32:39 +00:00
Chris Lattner
51680e3fdc
remove the deprecated error/warning/note methods, finally.
...
Swift SVN r776
2011-10-22 00:26:34 +00:00
Chris Lattner
9f906da738
sink (a copy of) HadError into DiagnosticEngine, so that errors produced by it trigger error returns from main().
...
Swift SVN r768
2011-10-20 20:55:22 +00:00
Chris Lattner
7aaf0c5e0c
rework the canonical type system a bit to make it so that all Types can access
...
their ASTContext without bloating everything. Basically, now instead of having
a canonical type point to itself when canonical, it points to the ASTContext
when canonical. This means that Canonical types always have direct access to
their context and non-canonical ones just indirect through the canonical type
pointer to get to it (so it's two jumps away) by using a PointerUnion.
This should make type manipulation more straight-forward.
While we're at it, we actually memoize type canonicalization. Before we
forgot to remember the result in the canonical type pointer in Type.
Swift SVN r755
2011-10-18 22:32:56 +00:00
Chris Lattner
55651745b5
remove helper method, it is the same as T->isEqual(S, Ctx)
...
Swift SVN r752
2011-10-18 21:47:08 +00:00
Chris Lattner
a7c7d64fa0
Switch swift to use SourceLoc instead of SMLoc.
...
Also use the new getAdvancedLoc() method instead of hacking
on SMLoc directly.
Also fix the warning/note/error methods to forward through ASTContext
instead of being replicated everywhere.
Swift SVN r750
2011-10-18 01:22:29 +00:00
Doug Gregor
3d15bf3d55
Introduce a diagnostic-formatting engine and port most of the parser's
...
diagnostics over to it.
There are a few differences between this diagnostic engine and Clang's
engine:
- Diagnostics are specified by a .def file (Diagnostics.def), rather
than via tblgen, which drastically simplifies the build and makes
code completion work when you add a new diagnostic.
- Calls to the "diagnose()" method are safely typed based on the
argument types specified in the .def file, so it's harder to write a
diagnostic whose expected arguments (in the string) and whose actual
arguments (in the code) don't match.
- It uses variadic templates, so it hangs with the cool kids.
Swift SVN r734
2011-09-26 23:46:28 +00:00
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