Commit Graph

737 Commits

Author SHA1 Message Date
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
John McCall
de3c3ff04d Build an implicit expression to record the conversion
of a oneof to its underlying type.  Much better.



Swift SVN r881
2011-11-17 11:38:05 +00:00
Doug Gregor
1ed6cdbb09 Fix broken source-range information for expressions of the form "x.y".
Swift SVN r861
2011-11-10 17:25:08 +00:00
Doug Gregor
2e49b79617 Rename WalkOrder.h to Walk.h, and introduce typedefs for the function
types of the expression and statement walker into it, so we don't end
up typing the same darned things over and over again.


Swift SVN r859
2011-11-10 16:36:56 +00:00
Doug Gregor
9995a39aae Switch Expr::getLoc() over to an implementation that defaults to the
starting location of the expression, but can be overridden by
subclasses.


Swift SVN r856
2011-11-10 00:34:40 +00:00
Doug Gregor
0223f3edf1 Implement Expr::getSourceRange() and introduce proper support for this
function into all of the expression nodes. Re-implement
Expr::getStartLoc() in terms of this function, and add it's brother
Expr::getEndLoc(), removing the specialized implementations.

Clean up the source ranges of implicitly-created tuple expressions in
the process.


Swift SVN r855
2011-11-10 00:25:48 +00:00
Chris Lattner
da564d50d3 A long journey later, implement support for type inference of integer literals instead of
forcing them to int64 all the time.  Now the integer_literal_type in the standard library
is only used to resolve ambiguity in expressions.  Among other amazing things, we now
correctly accept:

  var x8 : int8 = 4

without a cast.

This still isn't doing any bounds checking and isn't checking the inferred type to tell if
it is compatible with integer literals (i.e. has a primitive conversion function from the
LLVM IR type).  Enough for now though.

This is progress towards rdar://10357238.



Swift SVN r814
2011-11-01 06:51:50 +00:00
Chris Lattner
3c43cae8b4 now that types can get their astcontext, remove some pointless argument passing.
Swift SVN r757
2011-10-18 23:25:42 +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
25ee366396 Add an lvalue-to-rvalue conversion AST node.
Swift SVN r742
2011-09-28 01:12:34 +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
bbf14c61d3 Macro metaprogramming for the Expr hierarchy.
Swift SVN r722
2011-09-23 06:29:28 +00:00
John McCall
b351394b6e Getterify the rest of Expr.h.
Swift SVN r719
2011-09-20 00:18:57 +00:00
John McCall
802262a7da More incremental getterization.
Swift SVN r718
2011-09-19 23:37:21 +00:00
John McCall
7a259f4bad Differentiate between the starting location and caret location of
an expression.  More incremental getterization.



Swift SVN r717
2011-09-19 22:45:58 +00:00