Commit Graph

2357 Commits

Author SHA1 Message Date
Dmitri Hrybenko
27f2279a9b Parser: fix recovery for 'case' with a keyword as a union element name
We used to skip too much code and produce confusing diagnostics.


Swift SVN r7855
2013-09-03 19:27:29 +00:00
Dmitri Hrybenko
3ed1303b91 Parser: improve recovery when the extension name is a keyword
Swift SVN r7827
2013-08-31 02:09:39 +00:00
Dmitri Hrybenko
23ced2fba3 Move the parseIdentifierDeclName() helper above parseDeclExtension()
(so that extension parsing can use these helpers)


Swift SVN r7824
2013-08-31 01:54:50 +00:00
Dmitri Hrybenko
d7cbadbff1 Parser: improve recovery when the protocol name is a keyword
Swift SVN r7822
2013-08-31 00:08:41 +00:00
Dmitri Hrybenko
71430d0f3f Parser: improve recovery when the union name is a keyword
Swift SVN r7820
2013-08-30 23:50:22 +00:00
Dmitri Hrybenko
dbbbe61295 Parser: improve recovery when the class name is a keyword
Swift SVN r7819
2013-08-30 23:46:56 +00:00
Dmitri Hrybenko
cc8cc64572 Parser: improve recovery when the struct name is a keyword
Swift SVN r7815
2013-08-30 23:40:43 +00:00
Jordan Rose
6d8a63756c Parse: reject [prefix] and [postfix] on the same function.
Swift SVN r7811
2013-08-30 23:20:32 +00:00
Dmitri Hrybenko
b8b02539af Parser: improve recovery when the typealias name is a keyword
Swift SVN r7810
2013-08-30 23:16:53 +00:00
Dmitri Hrybenko
35dd32fb58 Disallow 'self', 'Self', and other identifier keywords in decl names
The diagnostics are really bad, but this will be fixed in later commits.  This
commit is only about rejecting invalid code.


Swift SVN r7766
2013-08-29 23:53:30 +00:00
Dmitri Hrybenko
4a73138805 Parser: improve recovery when function name is a keyword
Swift SVN r7710
2013-08-29 01:10:42 +00:00
Dmitri Hrybenko
6d34a127ee parseDeclFunc(): improve recovery when the function parameter tuple is missing
Swift SVN r7708
2013-08-29 00:37:05 +00:00
Dmitri Hrybenko
3a6feb7814 Disallow constructors in protocols
Swift SVN r7701
2013-08-28 23:03:37 +00:00
Jordan Rose
fa3dd42c54 Don't parse function bodies in imported TUs.
...unless the functions are declared [transparent], or if we're in an
immediate mode (in which case we won't get a separate chance to link
against the imported TUs).

This is an optimization that will matter more when we start dealing with
Xcode projects with many cross-file dependencies, especially if we have
some kind of implicit import of the other source files in the project.

In the future, we may want to parse more function bodies for the purpose
of inlining, not just the transparent ones, but we weren't taking
advantage of that now, so it's not a regression. (We're still not taking
advantage of it even for [transparent] functions.)

Swift SVN r7698
2013-08-28 22:53:28 +00:00
Dmitri Hrybenko
2e98f855ad Parser: parse, discard and complain about parameter list in destructors
Swift SVN r7691
2013-08-28 21:56:12 +00:00
Dmitri Hrybenko
61783aeb74 Improve recovery and remove noise in diagnostics for 'constructor {}'
Swift SVN r7687
2013-08-28 21:22:22 +00:00
Dmitri Hrybenko
35ae80ae20 parseDeclConstructor(): don't give up on parsing the constructor if
constructors are not allowed in this context

Parse as much as we can for recovery.


Swift SVN r7682
2013-08-28 20:14:44 +00:00
Argyrios Kyrtzidis
6d57b49e02 Have the ASTWalker walk protocol declarations.
Also make the implicit AssociatedTypeDecl, created for a protocol, to have the
location of its protocol, otherwise the verifier will complain that a decl has no
source range.

Swift SVN r7673
2013-08-28 18:22:06 +00:00
Dmitri Hrybenko
69cfa73640 More 'this' -> 'self' replacements
Swift SVN r7657
2013-08-28 02:57:21 +00:00
Ted Kremenek
8f5b8ccb02 Rename "This" to "Self" and "this" to "self".
This was not likely an error-free change.  Where you see problems
please correct them.  This went through a fairly tedious audit
before committing, but comments might have been changed incorrectly,
not changed at all, etc.

Swift SVN r7631
2013-08-27 21:58:27 +00:00
Dmitri Hrybenko
db44574605 parseBraceItemList(): use ParserResult
Now we propagate error bits better, which decreases noise in diagnostics in one
case.


Swift SVN r7628
2013-08-27 19:01:15 +00:00
Dmitri Hrybenko
b1d08912c2 Code completion: complete types in extension declarations
Swift SVN r7552
2013-08-24 01:58:13 +00:00
Dmitri Hrybenko
45c4cc334f Brush up comments in Parser: no need to describe the return value of functions
that return ParserResult; use Doxygen syntax.


Swift SVN r7550
2013-08-24 01:25:19 +00:00
Dmitri Hrybenko
c7c67e0130 Code completion: complete types in the union inheritance clause
Swift SVN r7549
2013-08-24 01:04:53 +00:00
Dmitri Hrybenko
610d2b75cb Code completion: complete types in the protocol inheritance clause
Swift SVN r7545
2013-08-23 23:40:09 +00:00
Dmitri Hrybenko
b7bdb2b134 Remove redundant return
Swift SVN r7544
2013-08-23 23:37:49 +00:00
Dmitri Hrybenko
117d1516ea Parser: propagate code completion bits to the result
No testcase because we can not do code completion in nested types now.


Swift SVN r7542
2013-08-23 23:30:39 +00:00
Dmitri Hrybenko
7a02b7afd5 Code completion: complete types in the class inheritance clause
Swift SVN r7538
2013-08-23 22:52:46 +00:00
Dmitri Hrybenko
0cf6ba54fb Code completion: complete types in the struct inheritance clause
Swift SVN r7534
2013-08-23 22:13:35 +00:00
Dmitri Hrybenko
4bc13e6cd2 Code completion: complete types in the typealias inheritance clause
Swift SVN r7524
2013-08-23 21:10:53 +00:00
Dmitri Hrybenko
4980cb8217 parseTypeTupleBody(): propagate CodeCompletion bits from parsing individual
elements to the tuple ParserResult

Allows us to complete types in tuples (located in other places than the
function parameter lists).


Swift SVN r7484
2013-08-22 22:44:44 +00:00
Chris Lattner
69d0afb658 rename [force_inlining] to [transparent].
Swift SVN r7448
2013-08-22 16:05:41 +00:00
Dmitri Hrybenko
a56893dec2 parseDecl(): use ParserResult
Now we make the desicion to delay parsing if the parsed production contained a
code completion token, not if we just stopped at the code completion token.


Swift SVN r7442
2013-08-22 00:39:45 +00:00
Dmitri Hrybenko
ec7b2eb3db Parser: use ParserResult in the interface of parseExpr()
But the implementation of expression parsing still does not propagate the code
completion bits because it uses NullablePtr for results.


Swift SVN r7425
2013-08-21 21:10:09 +00:00
Dmitri Hrybenko
f7ad1c9b03 parseDeclVar(): use ParserStatus
Swift SVN r7421
2013-08-21 20:15:01 +00:00
Dmitri Hrybenko
ad2ca67858 parseDeclSubscript(): use ParserStatus
Swift SVN r7415
2013-08-21 19:15:55 +00:00
Dmitri Hrybenko
255aeae1f9 parseDeclUnionElement(): use ParserResult because this function returns at most
one Decl, no need to pass in a vector


Swift SVN r7414
2013-08-21 19:04:12 +00:00
Dmitri Hrybenko
76d11315b0 parseDeclImport(): use ParserResult because this function returns at most one
Decl, no need to pass in a vector


Swift SVN r7413
2013-08-21 18:49:24 +00:00
Dmitri Hrybenko
ecf4cc44b1 parseDeclClass(): use ParserResult because this function returns at most one
Decl, no need to pass in a vector


Swift SVN r7410
2013-08-21 18:26:23 +00:00
Dmitri Hrybenko
e392e1a551 parseStruct(): use ParserResult because this function returns at most one Decl,
no need to pass in a vector


Swift SVN r7407
2013-08-21 18:10:16 +00:00
Dmitri Hrybenko
53685fe05f parseUnion(): use ParserResult because; it returns at most one Decl, no need to
pass in a vector

This a bit of noise to the diagnostics (see test change); this issue will be
fixed uniformly for all nominal decls in future commits.


Swift SVN r7399
2013-08-21 02:23:38 +00:00
Dmitri Hrybenko
354c5f4a18 Parser: replace diagnose(Tok.getLoc(), ...) -> diagnose(Tok, ...)
We already had the Parser::diagnose(Token, ...) overload, but it was not used
in all these cases.


Swift SVN r7395
2013-08-21 00:26:30 +00:00
Dmitri Hrybenko
581db767bf Use ParserResult and ParserStatus in tuple and function argument parsing
This finally fixes a few code completion test cases.

This also regresses the error message in one parsing testcase because
previously we would just happily skip those tokens, but now error handling path
is a little bit different and these tokens hit different error handling code.
This can be fixed by parsing a tuple for the selector argument and complaining
if the tuple had more than one element.


Swift SVN r7389
2013-08-20 23:55:00 +00:00
Dmitri Hrybenko
73353d9e48 Remove an unused variable
Swift SVN r7386
2013-08-20 23:20:49 +00:00
John McCall
329a5e47db Permit attribute lists to be split into multiple clauses.
This is particularly convenient for dealing with generated
code (e.g. as produced by the SIL printer), but it's also
quite defensible as a way for users to logically group
related attributes and split unrelated ones out, should
users find themselves using a lot of verbose attributes
(and prior experience with e.g. user-defined attributes
is that they definitely do sometimes turn into walls of
text...).

Swift SVN r7376
2013-08-20 22:37:38 +00:00
Dmitri Hrybenko
c3954987d6 Parser: use ParserResult in parseTypeSimple() and everything that uses it/
is used in it


Swift SVN r7355
2013-08-20 02:12:31 +00:00
Dmitri Hrybenko
b0dd877454 Use ParserResult in type parsing
Swift SVN r7353
2013-08-20 01:19:31 +00:00
Doug Gregor
1ddb34fb71 Factor generic parameters and associated types into their own decl nodes.
Previously, TypeAliasDecl was used for typealiases, generic
parameters, and assocaited types, which is hideous and the source of
much confusion. Factor the latter two out into their own decl nodes,
with a common abstract base for "type parameters", and push these
nodes throughout the frontend.

No real functionality change, but this is a step toward uniquing
polymorphic types, among other things.


Swift SVN r7345
2013-08-19 23:36:58 +00:00
Dmitri Hrybenko
deff836592 Parser: use ParserResult in parseDeclFunc
Swift SVN r7341
2013-08-19 23:02:06 +00:00
Dmitri Hrybenko
c098cd1476 Parser: convert some pattern parsing functions to ParserResult
Swift SVN r7336
2013-08-19 22:38:34 +00:00