mirror of
https://github.com/apple/swift.git
synced 2025-12-25 12:15:36 +01:00
We were only keeping track of `RawSyntax` node IDs to incrementally transfer a syntax tree via JSON. However, AFAICT the incremental JSON transfer option has been superceeded by `SyntaxParseActions`, which are more efficient. So, let’s clean up and remove the `RawSyntax` node ID and JSON incremental transfer option. In places that still need a notion of `RawSyntax` identity (like determining the reused syntax regions), use the `RawSyntax`’s pointer instead of the manually created ID. In `incr_transfer_round_trip.py` always use the code path that uses the `SyntaxParseActions` and remove the transitional code that was still using the incremental JSON transfer but was never called.
302 lines
14 KiB
JSON
302 lines
14 KiB
JSON
{
|
|
"kind": "SourceFile",
|
|
"layout": [
|
|
{
|
|
"kind": "CodeBlockItemList",
|
|
"layout": [
|
|
{
|
|
"kind": "CodeBlockItem",
|
|
"layout": [
|
|
{
|
|
"kind": "StructDecl",
|
|
"layout": [
|
|
null,
|
|
null,
|
|
{
|
|
"tokenKind": {
|
|
"kind": "kw_struct"
|
|
},
|
|
"leadingTrivia": "\/\/ RUN: %swift-syntax-test -input-source-filename %s -serialize-raw-tree > %t\n\/\/ RUN: diff %t %S\/Inputs\/serialize_struct_decl.json -u\n\n",
|
|
"trailingTrivia": " ",
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "identifier",
|
|
"text": "Foo"
|
|
},
|
|
"leadingTrivia": "",
|
|
"trailingTrivia": " ",
|
|
"presence": "Present"
|
|
},
|
|
null,
|
|
null,
|
|
null,
|
|
{
|
|
"kind": "MemberDeclBlock",
|
|
"layout": [
|
|
{
|
|
"tokenKind": {
|
|
"kind": "l_brace"
|
|
},
|
|
"leadingTrivia": "",
|
|
"trailingTrivia": "",
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "MemberDeclList",
|
|
"layout": [
|
|
{
|
|
"kind": "MemberDeclListItem",
|
|
"layout": [
|
|
{
|
|
"kind": "VariableDecl",
|
|
"layout": [
|
|
null,
|
|
null,
|
|
{
|
|
"tokenKind": {
|
|
"kind": "kw_let"
|
|
},
|
|
"leadingTrivia": "\n ",
|
|
"trailingTrivia": " ",
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "PatternBindingList",
|
|
"layout": [
|
|
{
|
|
"kind": "PatternBinding",
|
|
"layout": [
|
|
{
|
|
"kind": "IdentifierPattern",
|
|
"layout": [
|
|
{
|
|
"tokenKind": {
|
|
"kind": "identifier",
|
|
"text": "bar"
|
|
},
|
|
"leadingTrivia": "",
|
|
"trailingTrivia": " ",
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "TypeAnnotation",
|
|
"layout": [
|
|
{
|
|
"tokenKind": {
|
|
"kind": "colon"
|
|
},
|
|
"leadingTrivia": "",
|
|
"trailingTrivia": " ",
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "SimpleTypeIdentifier",
|
|
"layout": [
|
|
{
|
|
"tokenKind": {
|
|
"kind": "identifier",
|
|
"text": "Int"
|
|
},
|
|
"leadingTrivia": "",
|
|
"trailingTrivia": "",
|
|
"presence": "Present"
|
|
},
|
|
null
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
null,
|
|
null,
|
|
null
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
null
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "MemberDeclListItem",
|
|
"layout": [
|
|
{
|
|
"kind": "VariableDecl",
|
|
"layout": [
|
|
null,
|
|
null,
|
|
{
|
|
"tokenKind": {
|
|
"kind": "kw_let"
|
|
},
|
|
"leadingTrivia": "\n\n ",
|
|
"trailingTrivia": " ",
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "PatternBindingList",
|
|
"layout": [
|
|
{
|
|
"kind": "PatternBinding",
|
|
"layout": [
|
|
{
|
|
"kind": "IdentifierPattern",
|
|
"layout": [
|
|
{
|
|
"tokenKind": {
|
|
"kind": "identifier",
|
|
"text": "baz"
|
|
},
|
|
"leadingTrivia": "",
|
|
"trailingTrivia": " ",
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "TypeAnnotation",
|
|
"layout": [
|
|
{
|
|
"tokenKind": {
|
|
"kind": "colon"
|
|
},
|
|
"leadingTrivia": "",
|
|
"trailingTrivia": " ",
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "SimpleTypeIdentifier",
|
|
"layout": [
|
|
{
|
|
"tokenKind": {
|
|
"kind": "identifier",
|
|
"text": "Array"
|
|
},
|
|
"leadingTrivia": "",
|
|
"trailingTrivia": " ",
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "GenericArgumentClause",
|
|
"layout": [
|
|
{
|
|
"tokenKind": {
|
|
"kind": "l_angle"
|
|
},
|
|
"leadingTrivia": "",
|
|
"trailingTrivia": " ",
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "GenericArgumentList",
|
|
"layout": [
|
|
{
|
|
"kind": "GenericArgument",
|
|
"layout": [
|
|
{
|
|
"kind": "SimpleTypeIdentifier",
|
|
"layout": [
|
|
{
|
|
"tokenKind": {
|
|
"kind": "identifier",
|
|
"text": "Int"
|
|
},
|
|
"leadingTrivia": "",
|
|
"trailingTrivia": " ",
|
|
"presence": "Present"
|
|
},
|
|
null
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
null
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "r_angle"
|
|
},
|
|
"leadingTrivia": "",
|
|
"trailingTrivia": "",
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
null,
|
|
null,
|
|
null
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
null
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "r_brace"
|
|
},
|
|
"leadingTrivia": "\n ",
|
|
"trailingTrivia": "",
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
null,
|
|
null
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "eof",
|
|
"text": ""
|
|
},
|
|
"leadingTrivia": "\n",
|
|
"trailingTrivia": "",
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|