Commit Graph

11 Commits

Author SHA1 Message Date
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
ea5f93807f [Syntax] Add 'unknown' token to Token.py 2018-03-14 20:38:48 +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
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
Harlan
9185ef5610 [Syntax] Add #selector and #keyPath tokens (#13615)
* [Syntax] Add #selector and #keyPath tokens

* [Syntax][test] Add #selector and #keyPath to syntax parsing tests

* [Syntax] Don't fatalError on an unknown token kind

* Fix test build error
2017-12-29 12:35:08 -05:00
Rintaro Ishizaki
53b2e0fe14 [Syntax] Parse composition type node 2017-12-15 10:52:10 -08:00
Harlan
d0339c2767 Add contextual_keyword and string_interpolation_anchor to SwiftSyntax (#13321) 2017-12-08 16:13:49 -05:00
Harlan
ade67ca899 [Syntax] Swift libSyntax API (#11320)
* Create Swift libSyntax API

This patch is an initial implementation of the Swift libSyntax API. It
aims to provide all features of the C++ API but exposed to Swift.

It currently resides in SwiftExperimental and will likely exist in a
molten state for a while.

* Only build SwiftSyntax on macOS
2017-08-14 16:47:48 -07:00
Harlan
a5098e6b69 Generate libSyntax API (#10926)
* Generate libSyntax API

This patch removes the hand-rolled libSyntax API and replaces it with an
API that's entirely automatically generated. This means the API is
guaranteed to be internally stylistically and functionally consistent.
2017-07-25 18:19:58 -07:00