Commit Graph

3461 Commits

Author SHA1 Message Date
Chris Lattner
f204abf010 introduce MetaTypeDecl (though nothing creates it yet)
Swift SVN r997
2012-01-06 20:50:56 +00:00
Chris Lattner
10b29da87d fix formating in -ast-dump
Swift SVN r910
2011-12-06 21:48:11 +00:00
Chris Lattner
3d8fe587c1 the world has moved to using getters, conform.
Swift SVN r894
2011-11-29 22:47:23 +00:00
Chris Lattner
d666cc4fda define ExtensionDecl.
Swift SVN r892
2011-11-29 22:40:24 +00:00
John McCall
94021a90be Finish getterizing Decl.h.
Swift SVN r889
2011-11-18 01:29:31 +00:00
John McCall
32736ea2ab Rename hasSingleElement to isTransparentType to better
capture what's being tested.  This also makes IR gen
correctly avoid a discriminator for a non-transparent
single-element oneof.



Swift SVN r887
2011-11-18 01:17:53 +00:00
John McCall
b700f171a2 More getters.
Swift SVN r886
2011-11-18 01:10:03 +00:00
John McCall
d716f82984 Getterize ValueDecl.
Swift SVN r885
2011-11-18 01:04:12 +00:00
John McCall
9079154ded Getterize TypeAliasDecl.
Swift SVN r884
2011-11-18 00:48:14 +00:00
John McCall
50fb0d63f6 More incremental getterization.
.w



Swift SVN r883
2011-11-18 00:29:15 +00:00
John McCall
d74f17259c Incremental getterization of Decl.h.
Swift SVN r882
2011-11-18 00:17:20 +00:00
Chris Lattner
7e96d0d53e embrace macro metaprogramming for decls.
Swift SVN r867
2011-11-10 22:08:46 +00:00
Chris Lattner
9e9f421f1a getAliasType() doesn't need an ASTContext argument anymore.
Swift SVN r816
2011-11-01 18:37:05 +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
John McCall
6b27921ce3 Propagate around l-value-ness. There aren't any interesting invariants
here yet.



Swift SVN r740
2011-09-27 23:46:08 +00:00
John McCall
54ff2ccf4a Lop the last word off ModuleDecl and TranslationUnitDecl.
Swift SVN r693
2011-09-06 21:43:46 +00:00
John McCall
4a0f713e62 Progress towards a builtin module.
Swift SVN r682
2011-09-03 05:35:49 +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
bd9e21ed01 add a method to get an ASTContext from a DeclContext.
Swift SVN r662
2011-08-31 23:09:32 +00:00
Chris Lattner
fb8621f53a introduce DeclVisitor, ExprVisitor, and StmtVisitor template typedefs.
Swift SVN r472
2011-07-31 20:46:12 +00:00
Chris Lattner
d5523fa257 rename ExprStmtVisitor to ASTVisitor.
Swift SVN r471
2011-07-31 20:41:11 +00:00
Chris Lattner
9279ebe82b add Decl visition to ExprStmtVisitor.h, switch Decl.cpp to print the same way
expr and stmt does.



Swift SVN r470
2011-07-31 20:38:13 +00:00
Chris Lattner
63ce0be641 make the big switch: {} are now statements, not expressions. This removes some
annoying things from the grammar (like expr-non-brace), and makes it so that 
the body/else of an if is just a statement.

This patch has a fairly serious caveat that we just drop function bodies on the
floor now, since we have no "stmtexpr" sort of thing to represent the syntactic
sugar that is func.  We'll fix that soon.


Swift SVN r462
2011-07-31 17:39:13 +00:00
Chris Lattner
0fc77abf5c Per discussion on swift-dev, unify 'meth' and 'func' syntax into just 'func' syntax
where you can optionally declare a receiver type.  This is cleaner both conceptually
and in implementation, and eliminates drug references. :)


Swift SVN r444
2011-07-24 20:11:35 +00:00
Chris Lattner
f3c270fa06 convert DeclKind to an scoped enum
Swift SVN r439
2011-07-24 18:44:56 +00:00
Chris Lattner
3af81cccbe raw_ostream and NullablePtr. While there are more types that
could be handled in similar ways, this gets the most of them.


Swift SVN r424
2011-07-19 06:09:31 +00:00
Chris Lattner
10017bef15 ArrayRef and SmallVector[Impl]
Swift SVN r423
2011-07-19 06:03:26 +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
9e8c82435a implement AST and sema support for methods. The example method in the
testcase now AST's to:

   (methdecl 'print2' type='(this : rect) -> (os : ostream) -> ()'
      (closure_expr type='(this : rect) -> (os : ostream) -> ()'
        (closure_expr type='(os : ostream) -> ()'
          (brace_expr type='()'
            (apply_expr type='int'
              (declref_expr type='(r : rect) -> int' decl=area)
              (tuple_expr type='(r : rect)'
                (declref_expr type='rect' decl=this)))))))

which seems right.  Some cleanups are pending.



Swift SVN r416
2011-07-19 05:26:51 +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
eb9d1353d2 Allow name binding to bind to struct elements.
Swift SVN r332
2011-03-23 06:36:01 +00:00
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
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
60cdb19d02 Add a new ImportDecl to represent imports.
Swift SVN r286
2011-03-19 06:22:47 +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
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
6d98e3f03e Fix some missing \n's
Swift SVN r257
2011-03-07 00:12:04 +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
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
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
cb9b1838a6 Introduce and create a new TypeAliasDecl for typealiases.
Swift SVN r227
2011-02-22 05:47:08 +00:00
Chris Lattner
ad4389edc8 Introduce a new TypeAliasDecl class and NamedTypeDecl parent class. We're not creating it yet, but hey it's there.
Swift SVN r226
2011-02-22 05:37:01 +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
f92a3d56d7 Implement parser support for structs, improve datadecl dumping.
Swift SVN r192
2010-10-10 06:38:24 +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