Owen Voorhees
43e2d107e1
[SE-0276] Implement multi-pattern catch clauses
...
Like switch cases, a catch clause may now include a comma-
separated list of patterns. The body will be executed if any
one of those patterns is matched.
This patch replaces `CatchStmt` with `CaseStmt` as the children
of `DoCatchStmt` in the AST. This necessitates a number of changes
throughout the compiler, including:
- Parser & libsyntax support for the new syntax and AST structure
- Typechecking of multi-pattern catches, including those which
contain bindings.
- SILGen support
- Code completion updates
- Profiler updates
- Name lookup changes
2020-04-04 09:28:26 -07:00
Rintaro Ishizaki
60341baf62
[SyntaxParse] Refactor generic requirement syntax structure
...
Re-apply a part of 0569cbfb28 after
reverting ASTGen changes. This is still an improvement.
2019-10-21 15:16:56 -07:00
Rintaro Ishizaki
9e99707e7f
[SyntaxParse] Don't discard 'typealias' without identifier
...
Fixes round trip issue
2019-10-17 13:18:56 -07:00
Rintaro Ishizaki
aeec682c90
[SyntaxParse] Prevent memory leak in Syntax parsing
...
Essentially re-applying b09f87594a
2019-10-15 16:27:32 -07:00
Rintaro Ishizaki
570ed9361f
Revert "Merge pull request #26883 from rintaro/revert-revert-26478-gsoc-2019-parser-types"
...
This reverts commit faaa3a859d , reversing
changes made to 62f947d6ba .
2019-10-14 15:18:05 -07:00
Rintaro Ishizaki
71aa44d07a
Revert "Merge pull request #26914 from rintaro/syntaxparse-genericargsyntax"
...
This reverts commit 0899eb6978 , reversing
changes made to b8f42d6165 .
2019-10-14 13:50:53 -07:00
Rintaro Ishizaki
149c8751a1
Revert "Merge pull request #26933 from rintaro/syntaxparse-roundtrip1"
...
This reverts commit 6fcbb40462 , reversing
changes made to 3a78945b15 .
2019-10-14 13:46:40 -07:00
Rintaro Ishizaki
8df497dab6
Revert "Merge pull request #26974 from rintaro/syntaxparse-roundtrip2"
...
This reverts commit 27ded648cf , reversing
changes made to 42fdacc079 .
2019-10-14 13:45:48 -07:00
Rintaro Ishizaki
97a6fbc332
Revert "Merge pull request #27000 from rintaro/syntaxparse-roundtrip3"
...
This reverts commit 0d84e7613a , reversing
changes made to f262601bb3 .
2019-10-14 13:43:43 -07:00
Rintaro Ishizaki
62408b0c78
Revert "Merge pull request #27046 from rintaro/syntaxparse-refactor-type"
...
This reverts commit a7d6612813 , reversing
changes made to 111fb37f74 .
2019-10-14 13:40:24 -07:00
Rintaro Ishizaki
00613db8db
Revert "Merge pull request #27230 from rintaro/syntaxparsse-rdar55421369"
...
This reverts commit b09f87594a , reversing
changes made to d0b7ecab00 .
2019-10-14 12:47:23 -07:00
Rintaro Ishizaki
8768832f24
Revert "Merge pull request #27281 from rintaro/reapply-syntaxparse-genericparam"
...
This reverts commit 5d3e8d6c83 , reversing
changes made to 27e881d97e .
2019-10-14 12:46:31 -07:00
Rintaro Ishizaki
baa0ef70b3
Revert "Merge pull request #27286 from nathawes/r55280477-tuple-type-syntax-round-trip"
...
This reverts commit 8555d1b84a , reversing
changes made to e315b6ff6a .
2019-10-14 12:39:44 -07:00
Rintaro Ishizaki
fbc7c6c1c5
Revert "Merge pull request #27416 from rintaro/syntaxparse-declassociatedtype"
...
This reverts commit 5726179da9 , reversing
changes made to d5adbe2c55 .
2019-10-14 12:19:53 -07:00
Rintaro Ishizaki
4eadbaa9f6
Revert "Merge pull request #27466 from rintaro/syntaxparse-type"
...
This reverts commit a4fcd26b38 , reversing
changes made to 88ecae4b9a .
2019-10-14 12:19:04 -07:00
Rintaro Ishizaki
c773c3b5cf
Revert "Merge pull request #27485 from rintaro/syntaxparse-decltypealias"
...
This reverts commit 8c5dcc0fe5 , reversing
changes made to af5eda5d24 .
2019-10-14 12:18:47 -07:00
Rintaro Ishizaki
2f40f2493b
Revert "Merge pull request #27565 from rintaro/syntaxparse-exprcollection"
...
This reverts commit 1724f5b704 , reversing
changes made to bc1a3eaaa5 .
2019-10-14 12:16:31 -07:00
Rintaro Ishizaki
0e8010d8b9
Revert "Merge pull request #27592 from rintaro/syntaxparse-exprtuple"
...
This reverts commit cdfd1ab2cf , reversing
changes made to eb02f20f99 .
2019-10-14 12:15:48 -07:00
Rintaro Ishizaki
bb08667bf5
[SyntaxParse] Parse tuple/paren expression syntax
2019-10-09 14:48:47 -07:00
Rintaro Ishizaki
0d4cf76ed0
[SyntaxParse] Renew parseListSyntax()
...
Optimize for libSyntax parsing.
The new 'parseListSyntax()' receives a vector storage, passes element
builder to the callback for populating the elements, then automatically
parses trailing commas. Also, it performs automatic recovery if the
element has an error (e.g. Skip until ',' or ')').
2019-10-08 23:11:08 -07:00
Rintaro Ishizaki
f42f60f233
[Syntax] Consolidate 'TupleElement' and 'FunctionCallArgument' kinds
...
into 'TupleExprElement'. They had exact the same layout.
2019-10-07 20:52:11 -07:00
Rintaro Ishizaki
5914325a02
[SyntaxParse] Parse typealias declaration
2019-10-02 14:24:33 -07:00
Rintaro Ishizaki
e7e45fd311
[SyntaxParse] Attach 'inout' to the type in tuple type parsing
...
instead of using that as a deprecated use of 'inout'.
2019-10-01 15:41:40 -07:00
Rintaro Ishizaki
dc3f110f60
[SyntaxParse] Modify parseTypeCollection()
...
Now we always construct Array/DictionaryTypeSyntax even if ']' is missing.
2019-10-01 15:41:40 -07:00
Rintaro Ishizaki
7b31d2b4fb
[SyntaxParse] Finish type parsing
...
- Type attributes
- SIL types
2019-10-01 15:40:10 -07:00
Rintaro Ishizaki
c56421c5be
[SyntaxParse] Ignore token in consecutive ID diagnostics
2019-09-27 23:52:39 -07:00
Rintaro Ishizaki
9eb4c216ee
Revert "Revert "[SyntaxParse] Parse associatedtype decl""
...
This reverts commit 859f90afc1 .
2019-09-27 23:52:39 -07:00
Rintaro Ishizaki
859f90afc1
Revert "[SyntaxParse] Parse associatedtype decl"
2019-09-25 11:00:21 -07:00
Rintaro Ishizaki
fc8a2e6f86
[SyntaxParse] Parse associatedtype decl
...
Along with inheritance clause.
2019-09-24 12:03:06 -07:00
Nathan Hawes
e89efa8f81
[parser] Fix tuple type round-tripping issue
...
`public init(a: (b || c))` became `public init(a: )(b || c)` after
round-tripping.
Resolves rdar://problem/55280477
2019-09-20 19:04:41 -07:00
Rintaro Ishizaki
f919b2ddd8
[SyntaxParse] Parse generic parameter clause and generic where clause
2019-09-19 23:09:58 -07:00
Rintaro Ishizaki
9f642f0bc1
Revert "Merge pull request #27203 from CodaFi/movin-on-up"
...
This reverts commit 387d2a9aee , reversing
changes made to bf1ab6c29d .
2019-09-17 16:42:44 -07:00
Robert Widmann
362b21926c
Revert "Merge pull request #26937 from rintaro/syntaxparse-leakfix"
...
This reverts commit e49401bbca , reversing
changes made to bd222ad71c .
2019-09-16 15:07:19 -07:00
Rintaro Ishizaki
a7d6612813
Merge pull request #27046 from rintaro/syntaxparse-refactor-type
...
[SyntaxParse] Refactor parsing facilities
2019-09-11 06:43:42 +02:00
Rintaro Ishizaki
c13f68881a
[SyntaxParse] Simplify syntax parsing result facilities
...
- Utilize ignoreToken() to skip tokens while keeping them in syntax tree
- SyntaxParsedResult now holds ParsedRawSyntaxNode and ParserStatus
- Simplify migration support for 'TypeName[]' type
- Use builder for generic argument clause parsing
2019-09-10 10:29:02 -07:00
Rintaro Ishizaki
8edea315cd
[Syntax] Abolish 'backtick' trivia
...
- Stop producing 'backtick' trivia for escaping identifier token. '`'s
are now parts of the token text
- Adjust and simplify C++ libSyntax APIs
- Add 'is_deprecated' property to Trivia.py to attribute SwiftSyntax
APIs
rdar://problem/54810608
2019-09-09 11:49:25 -07:00
Rintaro Ishizaki
e888a4008e
[SyntaxParse] Fix round-trip issue in protocol composition parsing
2019-09-03 12:31:18 -07:00
Rintaro Ishizaki
992cc032a7
[SyntaxParse] Don't discard 'typealias' without identifier
...
Fixes round trip issue
2019-08-30 16:59:40 -07:00
Rintaro Ishizaki
1ca90ef757
[SyntaxParse] Fix memory leaks
...
There were a few places discarding recorded syntax:
- '#<code-complete>' at top-level (this should be parsed as UnknownDecl).
- 'typealias' decl with inheritance clause in protocol decl.
2019-08-29 13:10:39 -07:00
Rintaro Ishizaki
974c9d130f
[SyntaxParse] Fix round-trip issue in function types
2019-08-29 10:58:41 -07:00
Rintaro Ishizaki
41eebd2072
[SyntaxParse] Fix round-trip issue in tuple type parsing
2019-08-28 17:04:43 -07:00
Rintaro Ishizaki
bdda81cdf5
[SyntaxParse] use parseGenericArgumentClauseSyntax()
2019-08-28 16:42:51 -07:00
Rintaro Ishizaki
807e3f342c
[SyntaxParse] Fix round-trip issue in generic argument parsing
...
When type parsing inside generic argument fails, '<' must be before
other parsed arguments.
2019-08-27 14:57:59 -07:00
Rintaro Ishizaki
cb308b7e53
Revert "Revert "[Parser] Decouple the parser from AST creation (part 2)""
...
This reverts commit 8ad3cc8a82 .
2019-08-27 14:36:41 -07:00
Rintaro Ishizaki
8ad3cc8a82
Revert "[Parser] Decouple the parser from AST creation (part 2)"
2019-08-27 12:28:48 -07:00
Jan Svoboda
77924c4b84
[Parser] Decouple the parser from AST creation (part 2)
...
Instead of creating the AST directly in the parser (and libSyntax or
SwiftSyntax via SyntaxParsingContext), make Parser to explicitly create
a tree of ParsedSyntaxNodes. Their OpaqueSyntaxNodes can be either
libSyntax or SwiftSyntax. If AST is needed, it can be generated from the
libSyntax tree.
2019-08-26 19:10:51 +02:00
Rintaro Ishizaki
223de71ad3
[Syntax] Create UnknownDecl node for orphan #else, et al. and SIL nodes
2019-08-16 00:59:20 +00:00
Rintaro Ishizaki
b2fd31daa1
Merge pull request #25843 from rintaro/syntax-tupletype-element-rdar52291805
...
[Syntax] Fix tuple type element parsing
2019-06-28 01:11:28 -07:00
Xi Ge
1fa5a67860
Merge pull request #25840 from nkcsgexi/test-diag-syntax
...
test: add a syntax parser test to ensure we don't diagnose disabled var
2019-06-27 20:37:31 -07:00
Rintaro Ishizaki
9c044fe107
[Syntax] Fix tuple type element parsing
...
* typo: `InoutToken` not `InOutToken`
* Use `EllipsisToken` like function parameters. Otherwise `,` is stored
at ellipsis position.
rdar://problem/52291805
2019-06-27 16:35:43 -07:00