mirror of
https://github.com/apple/swift.git
synced 2026-06-27 12:25:55 +02:00
c4604d700e
To construct struct syntax, this patch first specialized type inheritance clause. For protocol's class requirement, we currently treat it as an unknown type. This patch also teaches SyntaxParsingContext to collect syntax nodes from back in place. This is useful to squash multiple decl modifiers for declarations like function. This is not used for struct declaration because only accessibility modifier is allowed.
318 lines
10 KiB
JSON
318 lines
10 KiB
JSON
{
|
|
"kind": "SourceFile",
|
|
"layout": [
|
|
{
|
|
"kind": "DeclList",
|
|
"layout": [
|
|
{
|
|
"kind": "TopLevelCodeDecl",
|
|
"layout": [
|
|
{
|
|
"kind": "StmtList",
|
|
"layout": [
|
|
{
|
|
"kind": "DeclarationStmt",
|
|
"layout": [
|
|
{
|
|
"kind": "StructDecl",
|
|
"layout": [
|
|
{
|
|
"kind": "AttributeList",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
},
|
|
{
|
|
"kind": "DeclModifier",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "kw_struct"
|
|
},
|
|
"leadingTrivia": [
|
|
{
|
|
"kind": "LineComment",
|
|
"value": "\/\/ RUN: %swift-syntax-test -input-source-filename %s -serialize-raw-tree > %t"
|
|
},
|
|
{
|
|
"kind": "Newline",
|
|
"value": 1
|
|
},
|
|
{
|
|
"kind": "LineComment",
|
|
"value": "\/\/ RUN: diff %t %S\/Inputs\/serialize_multiple_decls.json"
|
|
},
|
|
{
|
|
"kind": "Newline",
|
|
"value": 2
|
|
}
|
|
],
|
|
"trailingTrivia": [
|
|
{
|
|
"kind": "Space",
|
|
"value": 1
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "identifier",
|
|
"text": "A"
|
|
},
|
|
"leadingTrivia": [
|
|
|
|
],
|
|
"trailingTrivia": [
|
|
{
|
|
"kind": "Space",
|
|
"value": 1
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "GenericParameterClause",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
},
|
|
{
|
|
"kind": "TypeInheritanceClause",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
},
|
|
{
|
|
"kind": "GenericWhereClause",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
},
|
|
{
|
|
"kind": "MemberDeclBlock",
|
|
"layout": [
|
|
{
|
|
"tokenKind": {
|
|
"kind": "l_brace"
|
|
},
|
|
"leadingTrivia": [
|
|
|
|
],
|
|
"trailingTrivia": [
|
|
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "DeclList",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "r_brace"
|
|
},
|
|
"leadingTrivia": [
|
|
{
|
|
"kind": "Newline",
|
|
"value": 1
|
|
}
|
|
],
|
|
"trailingTrivia": [
|
|
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "semi"
|
|
},
|
|
"leadingTrivia": [
|
|
|
|
],
|
|
"trailingTrivia": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "DeclarationStmt",
|
|
"layout": [
|
|
{
|
|
"kind": "StructDecl",
|
|
"layout": [
|
|
{
|
|
"kind": "AttributeList",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
},
|
|
{
|
|
"kind": "DeclModifier",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "kw_struct"
|
|
},
|
|
"leadingTrivia": [
|
|
{
|
|
"kind": "Newline",
|
|
"value": 2
|
|
}
|
|
],
|
|
"trailingTrivia": [
|
|
{
|
|
"kind": "Space",
|
|
"value": 1
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "identifier",
|
|
"text": "B"
|
|
},
|
|
"leadingTrivia": [
|
|
|
|
],
|
|
"trailingTrivia": [
|
|
{
|
|
"kind": "Space",
|
|
"value": 1
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "GenericParameterClause",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
},
|
|
{
|
|
"kind": "TypeInheritanceClause",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
},
|
|
{
|
|
"kind": "GenericWhereClause",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
},
|
|
{
|
|
"kind": "MemberDeclBlock",
|
|
"layout": [
|
|
{
|
|
"tokenKind": {
|
|
"kind": "l_brace"
|
|
},
|
|
"leadingTrivia": [
|
|
|
|
],
|
|
"trailingTrivia": [
|
|
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"kind": "DeclList",
|
|
"layout": [
|
|
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "r_brace"
|
|
},
|
|
"leadingTrivia": [
|
|
{
|
|
"kind": "Newline",
|
|
"value": 1
|
|
}
|
|
],
|
|
"trailingTrivia": [
|
|
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "semi"
|
|
},
|
|
"leadingTrivia": [
|
|
|
|
],
|
|
"trailingTrivia": [
|
|
|
|
],
|
|
"presence": "Missing"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
},
|
|
{
|
|
"tokenKind": {
|
|
"kind": "eof"
|
|
},
|
|
"leadingTrivia": [
|
|
{
|
|
"kind": "Newline",
|
|
"value": 1
|
|
}
|
|
],
|
|
"trailingTrivia": [
|
|
|
|
],
|
|
"presence": "Present"
|
|
}
|
|
],
|
|
"presence": "Present"
|
|
}
|