Skip to content

Commit f495286

Browse files
committed
Add BuilderInitializableTypes to syntax builder generation
1 parent d394d84 commit f495286

File tree

5 files changed

+61
-0
lines changed

5 files changed

+61
-0
lines changed

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ let package = Package(
104104
"gyb_helpers",
105105
"AttributeNodes.swift.gyb",
106106
"AvailabilityNodes.swift.gyb",
107+
"BuilderInitializableTypes.swift.gyb",
107108
"Classification.swift.gyb",
108109
"CommonNodes.swift.gyb",
109110
"DeclNodes.swift.gyb",
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
%{
2+
from gyb_syntax_support import *
3+
from gyb_helpers import BUILDER_INITIALIZABLE_TYPES
4+
# -*- mode: Swift -*-
5+
# Ignore the following admonition; it applies to the resulting .swift file only
6+
}%
7+
//// Automatically Generated From BuilderInitializableTypes.swift.gyb.
8+
//// Do Not Edit Directly!
9+
//===----------------------------------------------------------------------===//
10+
//
11+
// This source file is part of the Swift.org open source project
12+
//
13+
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
14+
// Licensed under Apache License v2.0 with Runtime Library Exception
15+
//
16+
// See https://swift.org/LICENSE.txt for license information
17+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
18+
//
19+
//===----------------------------------------------------------------------===//
20+
21+
let BUILDER_INITIALIZABLE_TYPES: [String: String?] = [
22+
% for type, resolved_type in BUILDER_INITIALIZABLE_TYPES.items():
23+
"${type}": ${'"' + resolved_type + '"' if resolved_type is not None else 'nil'},
24+
% end
25+
]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//// Automatically Generated From BuilderInitializableTypes.swift.gyb.
2+
//// Do Not Edit Directly!
3+
//===----------------------------------------------------------------------===//
4+
//
5+
// This source file is part of the Swift.org open source project
6+
//
7+
// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
8+
// Licensed under Apache License v2.0 with Runtime Library Exception
9+
//
10+
// See https://swift.org/LICENSE.txt for license information
11+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
12+
//
13+
//===----------------------------------------------------------------------===//
14+
15+
let BUILDER_INITIALIZABLE_TYPES: [String: String?] = [
16+
"CodeBlock": "CodeBlockItemList",
17+
"MemberDeclBlock": "MemberDeclList",
18+
"CodeBlockItemList": nil,
19+
"MemberDeclList": nil,
20+
"PatternBindingList": nil,
21+
"SwitchCaseList": nil,
22+
"ArrayElementList": nil,
23+
"TupleExprElementList": nil,
24+
"EnumCaseElementList": nil,
25+
"FunctionParameterList": nil,
26+
"GenericParameterList": nil,
27+
"GenericRequirementList": nil,
28+
"InheritedTypeList": nil,
29+
"ClosureCaptureItemList": nil,
30+
"CaseItemList": nil,
31+
"GenericArgumentList": nil,
32+
"TuplePatternElementList": nil,
33+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../SwiftSyntaxBuilder/gyb_helpers/BuilderInitializableTypes.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from .utils import make_swift_child, make_swift_node
2+
from .BuilderInitializableTypes import BUILDER_INITIALIZABLE_TYPES
23
from .ExpressibleAsConformances import SYNTAX_BUILDABLE_EXPRESSIBLE_AS_CONFORMANCES

0 commit comments

Comments
 (0)