Commit Graph

1201 Commits

Author SHA1 Message Date
Eli Friedman
b65f969193 Replace ":foo" syntax for oneof members with ".foo".
Swift SVN r1288
2012-03-29 01:58:55 +00:00
Doug Gregor
e17398510a Re-pack a few Expr nodes for the inevitable switch to 32-bit source
locations.


Swift SVN r1283
2012-03-28 23:54:38 +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
d2bbf81245 Zap AnonClosureArgExpr.
Swift SVN r1269
2012-03-27 01:03:15 +00:00
Chris Lattner
f78a4e0be5 implement a bit of context sensitive overload set resolution, resolving some fixme's
in name-binding and making progress towards 11088443


Swift SVN r1256
2012-03-25 03:28:17 +00:00
Eli Friedman
80b55617ba Start of computing captures for CapturingExprs in the AST; only works for ExplicitClosureExprs so far. Per previous discussion, anything which can be captured goes through the relevant codepath in Parser::actOnIdentifierExpr.
Swift SVN r1251
2012-03-22 02:37:57 +00:00
Eli Friedman
ea17adc3ec Completely switch over IRGen for closures to use the standard prologue/epilogue emission.
Swift SVN r1250
2012-03-22 01:04:05 +00:00
Eli Friedman
fdc45c7611 Store the VarDecls and Patterns for AnonClosureArgExpr and ExplicitClosureExpr in the AST.
It might be possible to save some memory by breaking the AnonClosureArgExpr linked list during type-checking... not sure if that's worthwhile.



Swift SVN r1248
2012-03-20 21:43:36 +00:00
Eli Friedman
8ece7c0103 Fix a few minor typos.
Swift SVN r1241
2012-03-20 01:23:44 +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
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
4e4c1bf417 rename DotSyntaxPlusFuncUseExpr -> DotSyntaxBaseIgnoredExpr
to properly represent its newly generalized role.  It is formed
for things like "swift.print" where swift is a module type and is
evaluated and ignored.


Swift SVN r1230
2012-03-19 05:23:39 +00:00
Chris Lattner
11f3d2bcae implement a method to get the 'this' argument for a FuncExpr if there is one.
Swift SVN r1204
2012-03-11 23:35:48 +00:00
Chris Lattner
0cccfe9299 rename the Walker class to ASTWalker to match ASTVisitor.
Swift SVN r1201
2012-03-11 16:28:50 +00:00
Chris Lattner
0340dd17d0 rename Walk.h to Walker.h to match the name of the class it declares.
Swift SVN r1200
2012-03-11 16:22:26 +00:00
Chris Lattner
3b0db63f85 introduce ImplicitThisTupleElementExpr, progress towards 10682135.
IRGen should really use visitors for expr emission...


Swift SVN r1199
2012-03-11 15:02:16 +00:00
Chris Lattner
d75f76a096 split TupleElementExpr into an abstract TupleElementExpr class and a concrete
SyntacticTupleElementExpr class.  One step towards resolving rdar://10682135.


Swift SVN r1195
2012-03-11 14:48:04 +00:00
Chris Lattner
e3f6f4b87a Convert test cases to use the new auto_closure attribute,
inform conversion ranking about auto_closure, and rip out the
CR_AutoClosure implicit conversion.  Our conversion ranking is
now completely trivial: we either have an identity conversion
or an invalid one - no crazy implicit conversions (still have
tuple shuffles etc though).


Swift SVN r1192
2012-03-11 14:08:40 +00:00
Chris Lattner
d3b8e8b09e Now that we have a list of all argument uses in a closure,
eliminate BindAndValidateClosureArgs and replace a tree
walk with a simple linked list traversal.



Swift SVN r1163
2012-03-05 11:23:26 +00:00
Chris Lattner
7b2660db69 Whenever a AnonClosureArgExpr is parsed, immediately add it to a
list on the containing and owning closure.


Swift SVN r1161
2012-03-04 17:53:33 +00:00
Chris Lattner
4fde79bfac have the parser keep track of the current explicit closure and diagnose when an
argument is found outside any closure.


Swift SVN r1160
2012-03-04 05:37:13 +00:00
Chris Lattner
2564713a47 Implement parser and the first part of sema support for explicit
closures.  Start by rejecting closures inferred to have non-function type.


Swift SVN r1156
2012-03-04 04:34:45 +00:00
Chris Lattner
6aac93155d add an AST node to represent explicit closures. Not yet created.
Swift SVN r1154
2012-03-03 12:12:57 +00:00
Chris Lattner
3a6e84f82e Add a new "ImplicitClosureExpr" subclass of ClosureExpr to represent the autoclosure case.
Swift SVN r1152
2012-03-03 11:54:43 +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
a9120cf1bf Stop storing the lvalue-projection bit on TupleElementExpr and
LookThroughOneofExpr.

Swift SVN r1114
2012-02-16 01:57:07 +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
e66c13cfe7 Change the 'walk' APIs to use virtual function dispatch
instead .
1,2d
1i
Change the 'walk' APIs to use virtual dispatch instead of
blocks.  This makes it much easier to thread information
through the API, as well to extend the API to handle
recursive visiting of other structures (e.g., Decls
and Patterns).



Swift SVN r1101
2012-01-26 04:31:38 +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
John McCall
16f8b2e656 Revise the language design for function argument clause syntax.
A function argument clause is now one or more patterns (which
must be parenthesized and explicitly type all positions) not
separated by arrows;  the first arrow then separates off the
return type.

Revisions to language reference forthcoming.



Swift SVN r1099
2012-01-26 01:25:26 +00:00
Chris Lattner
bab9ca384c switch TupleExpr to use MutableArrayRef.
Swift SVN r1090
2012-01-19 06:54:43 +00:00
John McCall
213d61361a It is no longer necessary to remember all the ArgDecls
in a FuncExpr.  This coincidentally means that we can
create the FuncExpr before we create the ArgDecls and
thus avoid the need to reparent them all.



Swift SVN r1081
2012-01-18 07:45:44 +00:00
Chris Lattner
584ed537fc introduce a new ErrorExpr to represent a subexpression that is semantically
inconsistent (so it needs to be killed) but that we want to retain source
range information and not kill the entire subtree that contains it.


Swift SVN r1073
2012-01-18 07:18:57 +00:00
Chris Lattner
fab4ef8820 introduce a new OverloadSetRefExpr::createWithCopy method to eliminate
some redundancy in the code that always has to create an overload set
or a single declrefexpr depending on what various lookups produce.


Swift SVN r1044
2012-01-14 07:22:25 +00:00
Chris Lattner
f1db6de509 remove the :: token and DCE UnresolvedScopedIdentifierExpr.
Swift SVN r1043
2012-01-14 07:00:45 +00:00
John McCall
1ec9db43c8 Provide helper methods to look through parentheses. Learning
from Clang, actually give these explicit high-level behavior
rules so that it's clear what should be added to them in the
future.



Swift SVN r1037
2012-01-13 10:07:17 +00:00
Chris Lattner
be666df09e introduce a ModuleExpr node.
Swift SVN r1035
2012-01-13 05:07:21 +00:00
Chris Lattner
5d3158bae2 Simplify this now that the base of an unresolved dot reference is always non-null
Swift SVN r1023
2012-01-12 20:27:17 +00:00
John McCall
59bed696a5 Introduce a ParenExpr to represent the special case of
a tuple with one element and no labels.  This form is
treated specially in essentially every case, so it might
as well be its own expression kind.



Swift SVN r1021
2012-01-12 19:55:06 +00:00
Chris Lattner
e3a97a5b36 enhance type checking of apply exprs to handle application of an
argument list to a metatype.  No functionality change since nothing 
injects metatype'd values into a scope that can be looked up yet.


Swift SVN r1009
2012-01-12 06:10:02 +00:00
Chris Lattner
9f5d37dd2f introduce a new ConstructorCallExpr node, which is sugar node used to represent
the syntactic form of an argument list applied to a metatype.  Semantically,
this is yet-another ApplyExpr.


Swift SVN r1008
2012-01-12 05:43:07 +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
320e4747cc Codegen was silently truncating IntegerLiteralExpr's to 64 bits, bad codegen!
Swift SVN r979
2011-12-23 00:04:06 +00:00
Chris Lattner
926a3fe671 completely reimplement floating point literals to follow the model of integer literals.
Among other things, this gives us the amazing power to accept "var x : float = 0.0"



Swift SVN r978
2011-12-22 23:50:03 +00:00
Chris Lattner
8ce4737534 implement "a.b" AST and type checker support. Semantics are that 'a' is evaluated and discard. 'b' is evaluated and returned.
Swift SVN r950
2011-12-21 23:49:30 +00:00
Chris Lattner
eef2f69637 improve AST modeling of dot syntax calls to follow the syntactic structure instead of being weird and broken and losing source loc info.
Swift SVN r938
2011-12-15 00:52:58 +00:00
Chris Lattner
affba280f0 fix constness.
Swift SVN r936
2011-12-15 00:37:03 +00:00
Chris Lattner
d4a5cea2c7 consolidate routines for applying a type to an integer literal, and move our current sema for too-large integer values to it.
Swift SVN r924
2011-12-13 19:37:13 +00:00
Chris Lattner
a1b7419a36 remove support for looking up global names with dot syntax. "x.y" != "y(x)" now.
Swift SVN r917
2011-12-07 00:59:09 +00:00