Commit Graph

1224 Commits

Author SHA1 Message Date
Daniel Duan
7a682a46b9 [Parse] Allow self rebinding
Instead of parisng identifiers and fallthrough to self, treat `kw_self` the same
as identifiers. This enables binding to self.
2018-03-26 10:24:54 -07:00
Rintaro Ishizaki
ea83df4c9d Merge pull request #15267 from rintaro/parse-exprprimary
[Parse] Rename 'parseExprPostfixWithoutSuffix' to 'parseExprPrimary' and cleanups
2018-03-17 13:16:35 +09:00
Slava Pestov
34fd4ae512 AST: Use DeclBaseName::Kind::Constructor
Fixes <rdar://problem/35852727>, <https://bugs.swift.org/browse/SR-1660>,
<https://bugs.swift.org/browse/SR-6557>.
2018-03-16 00:25:56 -07:00
Rintaro Ishizaki
e72af86f04 [Parse] Remove unnecessary brace in switch-case 2018-03-15 17:45:32 +09:00
Rintaro Ishizaki
5bab791974 [Parse] Don't parse identifier expression call suffix in parseExprPrimary
It is eventually parsed in parseExprPostfixSuffix()
2018-03-15 17:45:32 +09:00
Rintaro Ishizaki
c9caef633b [Syntax] Don't create unnecessary SyntaxParsingContext 2018-03-15 17:45:32 +09:00
Rintaro Ishizaki
a241431239 [Parse] Directly return from switch-case in parseExprPrimary
NFC
2018-03-15 17:45:32 +09:00
Rintaro Ishizaki
3347d56465 [gardening] Rename parseExprPostfixWithoutSuffix to parseExprPrimary 2018-03-15 17:45:32 +09:00
Rintaro Ishizaki
444451eb6c [gardening] Remove unused LSquareLoc parameter from parseExprCollection 2018-03-15 15:45:37 +09:00
Rintaro Ishizaki
0a26e287ba [Parse] Diagnose unknown pound expressions
Implemented diagnostics for `'#' identifier arguments?` at expression
position.
Also, added back diagnostics (and fix-it) for legacy object literals.
2018-03-15 15:36:51 +09:00
Rintaro Ishizaki
bdcd87754d [Parse] Eliminate POUND_OLD_OBJECT_LITERAL tokens
We don't want to handle them in libSyntax
2018-03-14 21:50:53 +09:00
Rintaro Ishizaki
7237875870 [Parse] Eliminate square_lit token 2018-03-14 21:50:53 +09:00
Rintaro Ishizaki
66bcc00a72 [Parse] getLineNumber before parsing the closure (#15178)
Previously, if the closure has nested trailing closure, it slows down
because of cache in SourceMgr.
2018-03-12 22:44:10 +09:00
Sho Ikeda
74ba135008 Merge pull request #15040 from ikesyo/gardening-not-empty
[gardening] Use `!empty()` over `size() > 0`
2018-03-08 18:47:12 +09:00
Huon Wilson
e307e54098 [AST] Explicitly track things marked __owned. 2018-03-08 12:36:24 +11:00
Sho Ikeda
cea6c03eb2 [gardening] Use !empty() over size() > 0 2018-03-08 09:21:09 +09:00
Huon Wilson
b94c5364f5 [NFC] Rename 'Ownership' to 'ReferenceOwnership'.
There's really two forms of ownership: references and values. Renaming
to make way for better distinguishing of the two.
2018-03-02 11:38:28 -08:00
Rintaro Ishizaki
1eedcb7682 [Syntax] Parse '->' in sequence expression 2018-02-06 15:06:00 +09:00
Rintaro Ishizaki
e6307708d1 [Syntax] Parse 'type(of: <expr>)' syntax
In libSyntax, this is just a FunctionCallExpr.
2018-02-06 15:06:00 +09:00
Rintaro Ishizaki
5dc6b78457 [Syntax] Parse generic specialize expression 2018-02-06 15:05:59 +09:00
Rintaro Ishizaki
6ad01da279 [Syntax] Support parsing empty array expression. 2018-02-06 13:03:41 +09:00
Rintaro Ishizaki
2134f9f768 [Parse] Move SyntaxParsingContext to Parse (#14360)
This is only for the Parser.
Also, this resolves layering violation where libAST and libSyntax
depends on each other.
2018-02-03 10:43:52 +09:00
Rintaro Ishizaki
9bf4c8af05 [Syntax] Allow tok::dollarident (e.g. $0) for IdentifierExpr 2018-01-23 19:15:06 +09:00
Rintaro Ishizaki
bb7cf377ad [Syntax] Parse \.[0-9] expression as MemberAccessExpr 2018-01-23 19:15:06 +09:00
Rintaro Ishizaki
7f9578e5f3 [Syntax] Parse "dot self" expression nodes 2018-01-23 19:15:06 +09:00
Xi Ge
6cd5d0bf5e libSyntax: parse several magic identifier expressions.
They include #column, #file, #function and #dsohandle.
2018-01-10 18:02:02 -08:00
Xi Ge
7e4e7ff0bc libSyntax: parser object literal expressions.
This includes color, image and file literals.
2018-01-10 15:38:11 -08:00
Jordan Rose
ba469e1fbf Merge pull request #13809 from yasserdeceukelier/master
[Parser] Parse #keyPath in parseExprPostfixWithoutSuffix instead of parseExprUnary

Fixes SR-5605
2018-01-09 18:01:20 -08:00
Xi Ge
95f09d057e libSyntax: parse editor placeholder expression. (#13840) 2018-01-09 17:23:42 -08:00
Xi Ge
21f4564877 libSyntax: parse key path expressions. (#13813) 2018-01-08 20:54:53 -08:00
Xi Ge
1170a4ff01 libSyntax: parse InOut expression. (#13815) 2018-01-08 18:00:33 -08:00
Yasser Deceukelier
6bc96fe447 [Parser] Parse #keyPath in parseExprPostfixWithoutSuffix instead of parseExprUnary
Moved the call to parseExprKeyPathObjC from parseExprUnary to parseExprPostfixWithoutSuffix. This allows to perform operations on #keyPath(...) as it now parses the suffix for it.
Fixes [Swift JIRA]  (SR-5605) Parser fails on optional #keyPath in cas
Eg. `#keyPath(SomeClass.someProperty).description` is now possible
2018-01-08 22:51:39 +01:00
Xi Ge
7476677bb2 libSyntax: create separate node kinds for quote (") and multiline quote (""").
This allows us to serialize the quote tokens without serializing their
underlying text.
2018-01-04 09:08:21 -08:00
Xi Ge
22ce6934bd libSyntax: parse string interpolation expression. (#13708)
A string interpolation expression is composed of { OpenQuote, Segments,
CloseQuote }. To represent OpenQuote, CloseQuote and StringSegment, we have to
introduce new token kinds correspondingly.
2018-01-03 20:41:34 -08:00
Rintaro Ishizaki
2855c9e693 [Syntax] Add support for compound name in expressions (#13630) 2018-01-02 10:53:41 -08:00
Rintaro Ishizaki
ae6cc00f93 [Syntax] Fix round trip failure for keypath expressions
We don't need to backtrack here.
2017-12-27 17:29:27 +09:00
Rintaro Ishizaki
48eb60702e [Syntax] Stop using SyntaxBuilders for TypeIdentifier
Since we haven't handled error cases yet, Error type identifier (e.g.
'Array.+') used to case round trip problem.
2017-12-27 13:18:17 +09:00
Rintaro Ishizaki
015e1606dc [Syntax] Don't disable SyntaxParsingContext for compound names
This used to cause round trip problems.
TODO: Handle compound names in libSyntax.
2017-12-26 13:39:57 +09:00
Rintaro Ishizaki
8d33f763a4 [Syntax] Parse "implicit member expression " and its postfixes
Unlike libAST, parse '.foo(a)' as:
  <call><implicit-member>.foo</implicit-member><args>a</args></call>
2017-12-25 18:52:41 +09:00
Rintaro Ishizaki
b46bb721c6 [Syntax] Parse "super" and its postfix expressions 2017-12-25 17:47:36 +09:00
Rintaro Ishizaki
5d65b2f510 [Syntax] Parse several suffix expression nodes
* FunctionCallExpr
* SubscriptExpr
* OptionalChainingExpr
* ForcedValueExpr
* PostfixUnaryExpr
2017-12-25 17:21:05 +09:00
Rintaro Ishizaki
9f129a4dc6 Merge pull request #13555 from rintaro/syntax-pattern-part1
[Syntax] Parse pattern nodes
2017-12-21 08:32:54 +09:00
David Zarzycki
362d801472 [AST] NFC: Tail allocate CaptureListExpr entries 2017-12-20 09:35:15 -05:00
David Zarzycki
5a4e96fcc2 [AST] NFC: Tail allocate UnresolvedSpecializeExpr TypeLocs 2017-12-20 09:35:15 -05:00
Rintaro Ishizaki
89d9993f59 [Syntax] Parse matching pattern syntax node
Added support for ExprPattern and UnresolvedPatternExpr.
2017-12-20 19:47:32 +09:00
David Zarzycki
60d2f5586e [AST] QoI: Track DictionaryExpr commas and tail allocate CollectionExpr comma locs 2017-12-19 13:33:09 -05:00
Rintaro Ishizaki
24c7ea15e7 [Parse] Disable token receiver while parsing types in editor placeholder
Otherwise, for `<#T##Type#>`, `TokReceiver` records
 `{'<#T##Type#>', 'Type'}`.
2017-12-16 10:48:12 +09:00
Xi Ge
796c51cb1f libSyntax: specialize closure expression. (#13421) 2017-12-13 18:25:44 -08:00
Xi Ge
9ddd60d4ef libSyntax: create syntax nodes for closure signature. (#13415)
This patch also refactors the structure of function signature node so
that closure signature can re-use parts of function signature. For
instance, we group arrow and return type to be "ReturnClause". And we
group parenthesized parameter list to be "ParamClause".

This structure of closure signature also calls for a good way to
represent either-or node in libSyntax APIs, since we've two ways to
specify parameters in closure: one is as regular function parameter and
the other is dot-separated simple names.
2017-12-13 16:48:24 -08:00
Xi Ge
9e8d0aea81 libSyntax: create syntax node for closure capture list. (#13408) 2017-12-12 20:14:04 -08:00