Dmitri Hrybenko
3cc01cf7d6
Introduce AbstractFunctionDecl -- a base class for ConstructorDecl,
...
DestructorDecl, FuncDecl -- and move some of the common concepts and logic
into it
No functionality change.
Swift SVN r8090
2013-09-11 04:04:01 +00:00
Dmitri Hrybenko
1e23c936e0
Rename FuncDecl::getBody() to FuncDecl::getFuncExpr()
...
ConstructorDecl::getBody() and DestructorDecl::getBody() return 'BraceStmt *'.
After changing the AST representation for functions, FuncDecl::getBody() will
return 'BraceStmt *' and FuncDecl::getFuncExpr() will be gone.
Swift SVN r8050
2013-09-09 19:57:27 +00:00
Dmitri Hrybenko
4235c0c7ac
Mark some "expected {" diagnostics as PointsToFirstBadToken
...
Swift SVN r7970
2013-09-06 00:32:23 +00:00
Dmitri Hrybenko
df5d0a0272
Point the diagnostic "expected '{' in body of func declaration" to the first
...
invalid token (used to point to the function name).
Swift SVN r7967
2013-09-06 00:09:26 +00:00
Dmitri Hrybenko
d52982cd0d
Recovery from parsing extensions for non-nominal types: stop abusing the type
...
checker for what can be a simple syntactic check, when implemented on
appropriate level -- during type parsing.
Swift SVN r7954
2013-09-05 20:22:31 +00:00
Dmitri Hrybenko
08ac7f8255
Use nullptr instead of '0'
...
Swift SVN r7950
2013-09-05 17:59:50 +00:00
Dmitri Hrybenko
61794481ad
Remove dead code: BraceStmt::create never returns a null pointer
...
Swift SVN r7949
2013-09-05 17:57:36 +00:00
Dmitri Hrybenko
734fe3120d
parseDeclFunc(): sink error recovery for bad signature into
...
parseFunctionSignature() and add more tests
Swift SVN r7922
2013-09-04 23:02:24 +00:00
Dmitri Hrybenko
20ad7d830b
parseDeclFunc(): simplify a little bit and add a test
...
Swift SVN r7911
2013-09-04 21:28:11 +00:00
Dmitri Hrybenko
b49b9865c4
Remove unused overloads of parseIdentifierDeclName()
...
Swift SVN r7856
2013-09-03 19:30:11 +00:00
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