Commit Graph

3433 Commits

Author SHA1 Message Date
Chris Lattner
fbfb76a515 rename 'plus' methods to 'static' methods, resolving:
<rdar://problem/10718220> Need a better name than 'plus' for "static" functions



Swift SVN r1340
2012-04-06 17:50:43 +00:00
Eli Friedman
94244131f7 Remove ElementRefDecl and DeclVarName. Add the replacement, PatternBindingDecl. Use proper pattern parsing for variable declarations. Uniformly use PatternBindingDecl for variable initialization. Adapt type-checking and IRGen for this new style of variable declaration. <rdar://problem/11124980>.
Swift SVN r1312
2012-04-02 23:49:28 +00:00
Doug Gregor
f370accf59 Introduce the notion of structured dependent types, such as a tuple
type with one or more elements of dependent type. Previously, an
expression such as (x, 5) would have the (unstructured) dependent
type, limiting our ability to type-check the subexpression 'x'
early. Now, if 'x' has type 'int' (for example), this expression will
now have the type (int, <<unstructured dependent type>>).

Extend coercion of a tuple to tuple type to handle coercion to
(structured) dependent tuple types, coercing element-by-element. This
code is very lightly tested and may still need to be restructured.




Swift SVN r1294
2012-03-29 16:26:04 +00:00
Doug Gregor
22371781a5 Introduce TypeBase::isDependentType(), and use it rather than checks
against the DependentType class. No functionality change.


Swift SVN r1291
2012-03-29 14:03:57 +00:00
Eli Friedman
29f3fca950 First iteration of CaptureAnalysis.
Swift SVN r1284
2012-03-29 00:24:03 +00:00
Doug Gregor
5fffa75e7b Remove empty throw specifications from all of the overloaded new operators; reduces code size by 8k
Swift SVN r1282
2012-03-28 22:00:02 +00:00
Eli Friedman
d39a7abe36 Implement CapturingExpr. In addition to unifying the hierarchy between FuncExpr and ClosureExpr, this introduces a DeclContext for ClosureExprs. <rdar://problem/11076715>
Swift SVN r1240
2012-03-20 01:08:04 +00:00
John McCall
1a4b945a14 Flag in a ValueDecl whether it's ever been used as an
l-value or a heap l-value, except to immediate convert
it to an r-value or a non-heap l-value.

Swift SVN r1237
2012-03-19 08:28:42 +00:00
John McCall
2fd608ae4d Add basic parsing and type-system support for the byref(heap)
qualifier, making sure that variables end up so-qualified by
default.  Add a RequalifyExpr to capture the act of adding
qualifiers (to form a supertype) to an l-value.

Swift SVN r1236
2012-03-19 06:55:23 +00:00
Chris Lattner
6185ab6d50 move getImplicitThisDecl to FuncDecl where the other 'this' handling stuff goes.
Swift SVN r1233
2012-03-19 05:43:20 +00:00
Chris Lattner
1884e4943f refactor some code out of Sema into AST.
Swift SVN r1225
2012-03-17 23:07:00 +00:00
Chris Lattner
4c5f406928 don't crash when printing a decl that doesn't have its type set yet.
Swift SVN r1206
2012-03-11 23:55:47 +00:00
John McCall
00b97b38af Grab-bag of materialization-related changes:
- introduce the concept of qualifiers on l-value types
  - teach overload resolution and coercion how to drop explicitness
  - require explicitness on normal [byref] arguments
  - make 'this' [byref(implicit)]
  - special-case '&' as a unary operator in the parser to make it
    produce an expression which type-checks as turning implicit l-values
    into explicit ones.

Obvious missing pieces:
  - updating LangRef
  - we should really complain about ever trying to rvalue-convert an
    explicit l-value
  - maybe qualification should play a part in overload resolution
  - we should diagnose attempts to declare unary '&' operators
  - there's a test case in expressions.swift which suggests my logic is
    slightly off

But I am out of time, and these will have to wait.

Swift SVN r1119
2012-02-22 06:43:33 +00:00
John McCall
d0f4d86f3e Use LValueType everywhere instead of the l-value value kind.
Kill off TypeJudgement.  Various fixes and improvements.



Swift SVN r1107
2012-02-06 22:47:08 +00:00
John McCall
76ad8fff02 Add more parentheses to Types.h.
Swift SVN r1103
2012-01-31 04:32:37 +00:00
John McCall
ce7780af04 I don't think we're really getting anything out of ArgDecl
at the moment.  We can put it back if I'm wrong.



Swift SVN r1100
2012-01-26 02:08:52 +00:00
Chris Lattner
7c36780e35 sink the 'Init' field from ValueDecl down to VarDecl (as Init) and FuncDecl (as Body),
liberating the other ValueDecl's from its baggage.


Swift SVN r1079
2012-01-18 07:34:54 +00:00
Chris Lattner
7d0f7d53f9 improve type safety and specificity a bit, the body of a function is always a FuncExpr.
Swift SVN r1069
2012-01-18 06:56:53 +00:00
Chris Lattner
cb80e127a6 improve redefinition diagnostics since all type aliases are definitions, not declarations.
Swift SVN r1067
2012-01-18 06:52:15 +00:00
Chris Lattner
b01261632a getTypeJudgement() should now work on TypeAliasDecl's.
Swift SVN r1005
2012-01-11 07:29:39 +00:00
Chris Lattner
37cb633b12 Change TypeAliasDecl to be a ValueDecl, whose type is MetaTypeType.
Swift SVN r1004
2012-01-11 07:13:32 +00:00
Chris Lattner
e22a30a130 revert r995: "introduce MetaTypeDecl (though nothing creates it yet)".
After some pondering on this, I can just use DeclRefExpr(TypeAliasDecl) to
represent a named metatype, there is not need to have yet-another decl.  I'm
glad about this, because it didn't seem right.



Swift SVN r999
2012-01-11 05:42:22 +00:00
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