Commit Graph

11 Commits

Author SHA1 Message Date
Alex Hoppen
73cece2803 [libSyntax] Make SyntaxFactory methods instance methods
This saves us from passing in the SyntaxArena every time a new node is
created.
2021-03-03 11:02:55 +01:00
Alex Hoppen
7be84c115c [libSyntax] Adjust SyntaxTests that were potentially creating SyntaxArena reference cycles 2021-03-02 22:42:45 +01:00
Alex Hoppen
9ff88b2839 [libSyntax] Fix SwiftSyntaxTests broken due to change SyntaxFactory API
This fixes the SwiftSyntaxTests that were broken because the
SyntaxFactory API now requires an Arena in which the nodes should be
created.
2021-03-01 09:43:54 +01:00
Alex Hoppen
db3a520bc7 [libSyntax] Adjust tests for raw trivia being stored in RawSyntax 2021-02-05 08:15:54 +01: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
Saleem Abdulrasool
e07c00c652 Syntax: correct implementation for removing
`llvm::ArrayRef<T>` does not define `erase`.  However, since the intent
here is to remove the last n elements, we can use `drop_back` instead.
Furthermore, replace the direct use of `Layout` with `getLayout()`.
This was identified by gcc 8.2.
2018-10-29 11:39:31 -07:00
Rintaro Ishizaki
0780c529c4 [Syntax] Unify RawSyntax and RawTokenSyntax using union and TrailingObjects
It better matches with SwiftSyntax model.

Using TrailingObjects reduces the number of heap allocation which
gains 18% performance improvement.
2018-01-18 14:49:46 +09: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
Harlan
70089a7bcc [Syntax] Represent TokenSyntax as a Syntax node (#10606)
Previously, users of TokenSyntax would always deal with RC<TokenSyntax>
which is a subclass of RawSyntax. Instead, provide TokenSyntax as a
fully-realized Syntax node, that will always exist as a leaf in the
Syntax tree.

This hides the implementation detail of RawSyntax and SyntaxData
completely from clients of libSyntax, and paves the way for future
generation of Syntax nodes.
2017-06-27 11:08:10 -07:00
David Farler
e565392f81 [Syntax] Add convenience iterator for SyntaxCollections 2017-03-02 17:02:50 -08:00
David Farler
7ce3b81001 Add generic Syntax collection for unbounded list of nodes
Just a little reusable collection type for things like argument lists,
statement lists, etc.
2017-03-02 17:02:50 -08:00