Commit Graph

1233 Commits

Author SHA1 Message Date
Rintaro Ishizaki
a6f7a8ea35 [Parser] Set local discriminator to ParamDecls
We have to discriminate between params and local variables.
2018-05-11 15:37:40 +09:00
Alex Hoppen
05350cd0bb [libSyntax] Fix parsing of delayed function bodies 2018-04-27 08:10:19 -07:00
Alex Hoppen
94b8a3545b [libSyntax] Fix parsing for KeyPath 2018-04-25 13:30:31 -07:00
Alex Hoppen
3e9ae802c2 [libSyntax] Make parsing of attribute arguments more structured
This also fixes several issues where attribute arguments could not be
parsed as a TokenList since some of its arguments already had structure
and were not tokens
2018-04-24 13:18:15 -07:00
Alex Hoppen
c52f4a8131 [libSyntax] Fix parsing of operators passed to higher order functions 2018-04-23 12:23:27 -07:00
Rintaro Ishizaki
338cedd6d5 [Syntax] Parse '#selector' expression syntax 2018-04-12 13:56:04 +09:00
Xi Ge
3ee5954341 Merge pull request #15653 from rintaro/quickfix-rdar38988444
[code-completion] Fix compiler crash on implicit member expression in string interpolation
2018-04-02 10:03:25 -07:00
Rintaro Ishizaki
7a80547819 [code-completion] Fix compiler crash on implicit member expression in string interpolation
Resetting Lexer to the start of the line result re-tokenizning whole
string literal as a single token, and go past artificial EOF.
This used to end up with assertion failure or infinite-loop in
no-assertion builds.

Quick fix for: rdar://problem/36881302
2018-03-31 16:18:35 +09:00
David Zarzycki
67710606e6 [Parse] Move tok::amp_prefix closer to parameter list logic
The amp_prefix token is currently tolerated in any unary expression
context and then diagnosed later by Sema. This patch changes parsing to
only accept tok::amp_prefix in its allowed position: parameter lists.

This also fixes two "compiler crasher" tests.
2018-03-30 17:56:36 -04:00
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