Commit Graph

40 Commits

Author SHA1 Message Date
kitasuke
b583fef8e2 Consolidate StringInterpolationExpr to StringLiteralExpr 2019-05-12 11:23:00 +09:00
John McCall
7a4aeed570 Implement generalized accessors using yield-once coroutines.
For now, the accessors have been underscored as `_read` and `_modify`.
I'll prepare an evolution proposal for this feature which should allow
us to remove the underscores or, y'know, rename them to `purple` and
`lettuce`.

`_read` accessors do not make any effort yet to avoid copying the
value being yielded.  I'll work on it in follow-up patches.

Opaque accesses to properties and subscripts defined with `_modify`
accessors will use an inefficient `materializeForSet` pattern that
materializes the value to a temporary instead of accessing it in-place.
That will be fixed by migrating to `modify` over `materializeForSet`,
which is next up after the `read` optimizations.

SIL ownership verification doesn't pass yet for the test cases here
because of a general fault in SILGen where borrows can outlive their
borrowed value due to being cleaned up on the general cleanup stack
when the borrowed value is cleaned up on the formal-access stack.
Michael, Andy, and I discussed various ways to fix this, but it seems
clear to me that it's not in any way specific to coroutine accesses.

rdar://35399664
2018-07-23 18:59:58 -04:00
Rintaro Ishizaki
338cedd6d5 [Syntax] Parse '#selector' expression syntax 2018-04-12 13:56:04 +09:00
Rintaro Ishizaki
eb69497d64 [Syntax] Parse 'operator' declaration syntax 2018-04-12 13:55:55 +09:00
Rintaro Ishizaki
b457500389 [Syntax] Parse 'precedencegroup' declaration syntax 2018-04-11 23:21:54 +09:00
Rintaro Ishizaki
66d400eb1b [Syntax] Parse 'enum' and 'case' declaration (#15704) 2018-04-04 08:38:08 +09:00
Rintaro Ishizaki
4488e99a04 [Syntax] Parse 'switch' statement 2018-03-28 00:30:21 +09:00
Rintaro Ishizaki
5448075ef6 [Syntax] Update Status.md 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
a9670a7b84 [Syntax] Update Status.md 2018-02-06 09:33:12 +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
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
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
Yurii Samsoniuk
d5771cea6b Added extension specialization to libSyntax 2017-12-29 01:27:26 +09:00
Rintaro Ishizaki
e16a92c239 [Syntax] Update Status.md 2017-12-25 18:56:45 +09:00
Rintaro Ishizaki
cd429a4d21 [Syntax] Update Status.md for statements 2017-12-21 23:06:40 +09:00
Rintaro Ishizaki
1c96b47a69 [Syntax] Update Status.md for patterns 2017-12-20 21:01:10 +09:00
Rintaro Ishizaki
c379f5c232 [Syntax] Parse wildcard pattern node 2017-12-20 17:33:30 +09:00
Rintaro Ishizaki
a1340fd9a2 [Syntax] Parse tuple pattern node 2017-12-20 17:32:30 +09:00
Xi Ge
e0d167f1dd libSyntax: create syntax nodes for variable declarations.
Variable declarations are declarations led by either 'var' or 'let'. It
can contain multiple pattern bindings as children.

For patterns, this patch only creates syntax nodes for simple identifier
patterns, e.g. 'a = 3'. The rest of the pattern kinds are still left
unknown (UnknownPattern).
2017-12-19 12:25:51 -08:00
Xi Ge
94caecad30 [Doc] libSyntax: mark AttributedType as done. 2017-12-18 10:54:02 -08:00
Faiçal Tchirou
5e41098851 libSyntax: specialize class declaration syntax node. (#13485) 2017-12-16 11:36:58 -08:00
Xi Ge
df7db884cf libSyntax: create syntax nodes for IfConfigDecl. 2017-12-15 13:36:47 -08:00
Rintaro Ishizaki
53b2e0fe14 [Syntax] Parse composition type node 2017-12-15 10:52:10 -08:00
Rintaro Ishizaki
8b7afffd81 [Syntax] Update Status.md for type nodes 2017-12-15 10:52:10 -08:00
Xi Ge
b4b638651d libSyntax: create syntax node for typealias declarations. (#13450) 2017-12-14 17:44:54 -08:00
Xi Ge
139444f8b1 [Doc] libSyntax: Using "done" instead of "specialized". 2017-12-14 15:05:15 -08:00
Xi Ge
50eb2e3531 [Doc] libSyntax: add a document describing the status of libSyntax node specialization. NFC
This document breaks all existing syntactic AST nodes into five categories:
expression, declaration, statement, pattern and typerepr. Nodes in each
category can be further defined as "specialized", "in-progress" and
"not-specialized".

The parser currently can recognize specialized nodes; for "in-progress"
and "not-specialized" nodes, the parser will wrap their underlying source
to be an unknown entity, e.g. UnknownDecl or UnknownStmt.

"in-progress" nodes are considered in a higher priority to be specialized
than "not-specialized" nodes. However, eventually all nodes should be
marked as "specialized".
2017-12-14 13:51:27 -08:00
David Farler
b99df061f6 Update lib/Syntax/Status.md for function declarations
NFC.
2017-03-02 17:02:50 -08:00
David Farler
ff75fa7749 [Syntax] Roughly categorize unimpemented productions in Status.md 2017-02-27 13:57:33 -08:00
David Farler
c8bb2b8c32 [Syntax] Implement function-call-expression in lib/Syntax
Also includes for its substructure:
- function-call-argument
- function-call-argument-list
- symbolic-reference-expression (for the call target)

https://bugs.swift.org/browse/SR-4044
2017-02-27 13:57:27 -08:00
David Farler
19ed1dd62a [Syntax] Remove some more trivial/intermediate productions from Status.md
NFC.
2017-02-22 18:45:29 -08:00
David Farler
c343298b8f [Syntax] Implement return-statement and integer-literal-expr
A return statement needs something to return, so implement
integer-literal-expression too. This necessarily also forced
UnknownExprSyntax, UnknownStmtSyntax, and UnknownDeclSyntax,
which are stand-in token buckets for when we don't know
how to transform/migrate an AST.

This commit also contains the core function for caching
SyntaxData children. This is highly tricky code, with some
detailed comments in SyntaxData.{h,cpp}. The gist is that
we have to atomically swap in a SyntaxData pointer into the
child field, so we can maintain pointer identity of SyntaxData
nodes, while still being able to cache them internally.

To prove that this works, there is a multithreaded test that
checks that two threads can ask for a child that hasn't been
cached yet without crashing or violating pointer identity.

https://bugs.swift.org/browse/SR-4010
2017-02-22 18:45:29 -08:00
David Farler
1801c1ade1 [Syntax] Implement continue-statement in lib/Syntax
https://bugs.swift.org/browse/SR-3991
2017-02-17 22:57:52 -08:00
David Farler
e6ef58af43 [Syntax] Implement break-statement in lib/Syntax
https://bugs.swift.org/browse/SR-3990
2017-02-17 20:15:11 -08:00
David Farler
9627c5eafd [Syntax] Add Status.md document
This will show what is currently implemented, covered by tests,
and relevant Swift bugs / radars.
2017-02-17 12:57:04 -08:00