Commit Graph

1224 Commits

Author SHA1 Message Date
Chris Lattner
615ca4a360 implement the rest of character literal support, and enhance Char to be character literal
compatible.  This wraps up rdar://11305635, though some cleanup of the testsuite can now be done.


Swift SVN r1672
2012-04-27 06:18:30 +00:00
Chris Lattner
c7e68a4a8b langref and lexer support for character literals.
Swift SVN r1671
2012-04-27 05:51:30 +00:00
Doug Gregor
12ed53d8c1 Implement subscripting for SliceSliceInt64. Along the way, fix a silly
little parser bug that didn't allow a[i][j] to parse.


Swift SVN r1536
2012-04-20 19:43:22 +00:00
Doug Gregor
cd7be4edf1 Add an AST for subscript expressions; no real type checking yet.
Swift SVN r1512
2012-04-19 22:07:42 +00:00
John McCall
66318f5e12 First round of type-checking for new-expressions: form
the appropriate slice type and check the bounds.  The
first bound must be a literal or a type with a
getArrayBoundValue method, which has the same recursive
nature as getLogicValue (i.e. it can return a type that
has a getArrayBoundValue that returns an integral type,
but that's it;  it's capped at one hop).  The rest
of the bounds must be empty (meaning a slice) or
constant under the same conditions as fixed-size
array types.

Swift SVN r1501
2012-04-19 21:05:37 +00:00
John McCall
71157c65d5 Add parsing support, but no type-checking or IR-generation,
for new expressions.

Swift SVN r1466
2012-04-18 08:09:18 +00:00
John McCall
e6d56fd718 Require an unspaced [ to start a subscript or array-type suffix.
Per discussion, this should probably be "no newline since the last
token", but that decision should be made simultaneously for ( and [.

Swift SVN r1461
2012-04-18 08:08:58 +00:00
Chris Lattner
ce7403dd1e implement IRGen of escapes. High unicode escapes aren't handled yet, but all the
basics are.


Swift SVN r1363
2012-04-10 20:59:45 +00:00
Chris Lattner
5650d08ddf implement parsing, AST, and sema support for simple strings,
no irgen yet.


Swift SVN r1351
2012-04-10 01:25:51 +00:00
Eli Friedman
b65f969193 Replace ":foo" syntax for oneof members with ".foo".
Swift SVN r1288
2012-03-29 01:58:55 +00:00
Eli Friedman
d2bbf81245 Zap AnonClosureArgExpr.
Swift SVN r1269
2012-03-27 01:03:15 +00:00
Eli Friedman
a940cdd22b Compute capture lists for FuncExprs and ImplicitClosureExprs.
Swift SVN r1254
2012-03-23 22:06:21 +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
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
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
ce9d3c4398 remove Parser::isStartOfExpr, which is only used by one caller that can
be done in a simpler way.


Swift SVN r1150
2012-03-02 01:07:21 +00:00
Chris Lattner
58b4a5d7cc have the parser produce ErrorStmt nodes to handle semantic errors...
except that it never produces semantic errors.  How about that.


Swift SVN r1143
2012-03-01 22:54:41 +00:00
Chris Lattner
6692cba150 simplify expression parsing to return a NullablePtr<Expr> instead of a ParseError<Expr>.
The later could represent semantic errors, but we'd rather represent those with an
ExprError node instead.  This simplifies the code and allows the parser to build a more
fully-formed AST that IDE clients will like.


Swift SVN r1141
2012-03-01 22:34:32 +00:00
Chris Lattner
21c8b4dae9 implement a more-sane floating point literal syntax, adding support for
exponents.  This resolves rdar://10877508


Swift SVN r1140
2012-03-01 21:42:10 +00:00
Chris Lattner
1076367d73 implement rdar://10962528 - split up the int/fp literal lexing and grammar.
This cleans up handling of int/fp literals by splitting them appart at the
lexer level.


Swift SVN r1137
2012-03-01 19:06:55 +00:00
Chris Lattner
abb70d73eb remove dot syntax for tuple elements. Instead of (.x = 4, .y = 5) use the
simpler and newfangled (x = 4, y = 5) syntax.  rdar://10962605


Swift SVN r1134
2012-03-01 18:40:31 +00:00
Chris Lattner
17ea0a6670 finish my pass over LangRef, updating it and changing it and the parser to keep the grammars in sync.
Swift SVN r1132
2012-03-01 16:55:09 +00:00
Chris Lattner
cd29a77770 introduce a new parseIdentifier method that *just* parses identifiers,
but not operators.  Audit calls to make sure that we use the right one
in the right places.  This allows us to reject structs named * for example.


Swift SVN r1127
2012-02-26 18:20:58 +00:00
Chris Lattner
dd0c5aff52 Rename parseIdentifier to parseAnyIdentifier to match langref and
make it clear to it also allows operators.


Swift SVN r1126
2012-02-26 18:16:30 +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
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
Chris Lattner
27f47dd705 eliminate the concept of a singular expression, which is obsolete and not in lang ref.
Swift SVN r1084
2012-01-18 23:59:04 +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
John McCall
603f7a13b9 Modify this to not do a direct access to a private member.
I filed Clang PR11793 to track the apparent lapse in access
control.



Swift SVN r1071
2012-01-18 07:08:38 +00:00
John McCall
ea5e37e276 Getterize uses of TupleTypeElt. I'm trying to figure out how
parameter attributes should work here.



Swift SVN r1066
2012-01-18 04:05: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
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
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
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
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
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
John McCall
d74f17259c Incremental getterization of Decl.h.
Swift SVN r882
2011-11-18 00:17:20 +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
Chris Lattner
9e783adda1 introduce and use a new parseMatchingToken method.
Swift SVN r841
2011-11-09 01:09:07 +00:00
Chris Lattner
f02dc055d3 introduce a form of parseToken that returns the location of the parsed token
on success, allowing simplifications in clients.


Swift SVN r840
2011-11-09 00:56:52 +00:00
Chris Lattner
828045f8b5 make the dot optional in tuple literals, now you can use
foo(x = 4, 7) instead of foo(.x = 4, 7).  This resolves
rdar://10157455


Swift SVN r817
2011-11-01 21:06:22 +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
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
dfd529ce3a rename diags::foo to diag::foo
Swift SVN r779
2011-10-22 00:36:19 +00:00
Chris Lattner
a1781fed38 switch expr parsing to the new diagnostics subsystem
Swift SVN r766
2011-10-20 20:41:48 +00:00