@@ -40,7 +40,7 @@ interface Metadata {
4040
4141interface SlangNode {
4242 kind :
43- | keyof typeof NonterminalKind
43+ | NonterminalKind
4444 | typeof TerminalKind . Identifier
4545 | typeof TerminalKind . YulIdentifier
4646 | typeof TerminalKind . MultiLineComment
@@ -58,220 +58,9 @@ interface SlangNode {
5858
5959type PrintFunction = ( path : AstPath < AstNode > ) => Doc ;
6060
61- export type SlangAstNode =
62- | ast . SourceUnit
63- | ast . PragmaDirective
64- | ast . AbicoderPragma
65- | ast . ExperimentalPragma
66- | ast . VersionPragma
67- | ast . VersionRange
68- | ast . VersionTerm
69- | ast . ImportDirective
70- | ast . PathImport
71- | ast . NamedImport
72- | ast . ImportDeconstruction
73- | ast . ImportDeconstructionSymbol
74- | ast . ImportAlias
75- | ast . UsingDirective
76- | ast . UsingDeconstruction
77- | ast . UsingDeconstructionSymbol
78- | ast . UsingAlias
79- | ast . ContractDefinition
80- | ast . InheritanceSpecifier
81- | ast . InheritanceType
82- | ast . InterfaceDefinition
83- | ast . LibraryDefinition
84- | ast . StructDefinition
85- | ast . StructMember
86- | ast . EnumDefinition
87- | ast . ConstantDefinition
88- | ast . StateVariableDefinition
89- | ast . StateVariableDefinitionValue
90- | ast . FunctionDefinition
91- | ast . ParametersDeclaration
92- | ast . Parameter
93- | ast . OverrideSpecifier
94- | ast . OverridePathsDeclaration
95- | ast . ReturnsDeclaration
96- | ast . ConstructorDefinition
97- | ast . UnnamedFunctionDefinition
98- | ast . FallbackFunctionDefinition
99- | ast . ReceiveFunctionDefinition
100- | ast . ModifierDefinition
101- | ast . ModifierInvocation
102- | ast . EventDefinition
103- | ast . EventParametersDeclaration
104- | ast . EventParameter
105- | ast . UserDefinedValueTypeDefinition
106- | ast . ErrorDefinition
107- | ast . ErrorParametersDeclaration
108- | ast . ErrorParameter
109- | ast . ArrayTypeName
110- | ast . FunctionType
111- | ast . MappingType
112- | ast . MappingKey
113- | ast . MappingValue
114- | ast . AddressType
115- | ast . Block
116- | ast . UncheckedBlock
117- | ast . ExpressionStatement
118- | ast . AssemblyStatement
119- | ast . AssemblyFlagsDeclaration
120- | ast . TupleDeconstructionStatement
121- | ast . TupleDeconstructionElement
122- | ast . TypedTupleMember
123- | ast . UntypedTupleMember
124- | ast . VariableDeclarationStatement
125- | ast . VariableDeclarationValue
126- | ast . IfStatement
127- | ast . ElseBranch
128- | ast . ForStatement
129- | ast . WhileStatement
130- | ast . DoWhileStatement
131- | ast . ContinueStatement
132- | ast . BreakStatement
133- | ast . ReturnStatement
134- | ast . EmitStatement
135- | ast . TryStatement
136- | ast . CatchClause
137- | ast . CatchClauseError
138- | ast . RevertStatement
139- | ast . ThrowStatement
140- | ast . AssignmentExpression
141- | ast . ConditionalExpression
142- | ast . OrExpression
143- | ast . AndExpression
144- | ast . EqualityExpression
145- | ast . InequalityExpression
146- | ast . BitwiseOrExpression
147- | ast . BitwiseXorExpression
148- | ast . BitwiseAndExpression
149- | ast . ShiftExpression
150- | ast . AdditiveExpression
151- | ast . MultiplicativeExpression
152- | ast . ExponentiationExpression
153- | ast . PostfixExpression
154- | ast . PrefixExpression
155- | ast . FunctionCallExpression
156- | ast . CallOptionsExpression
157- | ast . MemberAccessExpression
158- | ast . IndexAccessExpression
159- | ast . IndexAccessEnd
160- | ast . PositionalArgumentsDeclaration
161- | ast . NamedArgumentsDeclaration
162- | ast . NamedArgumentGroup
163- | ast . NamedArgument
164- | ast . TypeExpression
165- | ast . NewExpression
166- | ast . TupleExpression
167- | ast . TupleValue
168- | ast . ArrayExpression
169- | ast . HexNumberExpression
170- | ast . DecimalNumberExpression
171- | ast . YulBlock
172- | ast . YulFunctionDefinition
173- | ast . YulParametersDeclaration
174- | ast . YulReturnsDeclaration
175- | ast . YulVariableDeclarationStatement
176- | ast . YulVariableDeclarationValue
177- | ast . YulVariableAssignmentStatement
178- | ast . YulStackAssignmentStatement
179- | ast . YulStackAssignmentOperator
180- | ast . YulColonAndEqual
181- | ast . YulEqualAndColon
182- | ast . YulIfStatement
183- | ast . YulForStatement
184- | ast . YulSwitchStatement
185- | ast . YulDefaultCase
186- | ast . YulValueCase
187- | ast . YulLeaveStatement
188- | ast . YulBreakStatement
189- | ast . YulContinueStatement
190- | ast . YulLabel
191- | ast . YulFunctionCallExpression
192- | ast . SourceUnitMember
193- | ast . Pragma
194- | ast . ExperimentalFeature
195- | ast . VersionExpression
196- | ast . VersionOperator
197- | ast . VersionLiteral
198- | ast . ImportClause
199- | ast . UsingClause
200- | ast . UsingOperator
201- | ast . UsingTarget
202- | ast . ContractMember
203- | ast . StateVariableAttribute
204- | ast . FunctionName
205- | ast . FunctionAttribute
206- | ast . FunctionBody
207- | ast . ConstructorAttribute
208- | ast . UnnamedFunctionAttribute
209- | ast . FallbackFunctionAttribute
210- | ast . ReceiveFunctionAttribute
211- | ast . ModifierAttribute
212- | ast . TypeName
213- | ast . FunctionTypeAttribute
214- | ast . MappingKeyType
215- | ast . ElementaryType
216- | ast . Statement
217- | ast . TupleMember
218- | ast . VariableDeclarationType
219- | ast . StorageLocation
220- | ast . ForStatementInitialization
221- | ast . ForStatementCondition
222- | ast . Expression
223- | ast . ArgumentsDeclaration
224- | ast . NumberUnit
225- | ast . StringExpression
226- | ast . StringLiteral
227- | ast . HexStringLiteral
228- | ast . UnicodeStringLiteral
229- | ast . YulStatement
230- | ast . YulAssignmentOperator
231- | ast . YulSwitchCase
232- | ast . YulExpression
233- | ast . YulLiteral
234- | ast . SourceUnitMembers
235- | ast . VersionExpressionSet
236- | ast . ContractMembers
237- | ast . InterfaceMembers
238- | ast . LibraryMembers
239- | ast . StructMembers
240- | ast . StateVariableAttributes
241- | ast . FunctionAttributes
242- | ast . ConstructorAttributes
243- | ast . UnnamedFunctionAttributes
244- | ast . FallbackFunctionAttributes
245- | ast . ReceiveFunctionAttributes
246- | ast . ModifierAttributes
247- | ast . FunctionTypeAttributes
248- | ast . Statements
249- | ast . CatchClauses
250- | ast . StringLiterals
251- | ast . HexStringLiterals
252- | ast . UnicodeStringLiterals
253- | ast . YulStatements
254- | ast . YulSwitchCases
255- | ast . VersionExpressionSets
256- | ast . SimpleVersionLiteral
257- | ast . ImportDeconstructionSymbols
258- | ast . UsingDeconstructionSymbols
259- | ast . InheritanceTypes
260- | ast . EnumMembers
261- | ast . Parameters
262- | ast . OverridePaths
263- | ast . EventParameters
264- | ast . ErrorParameters
265- | ast . AssemblyFlags
266- | ast . TupleDeconstructionElements
267- | ast . PositionalArguments
268- | ast . NamedArguments
269- | ast . CallOptions
270- | ast . TupleValues
271- | ast . ArrayValues
272- | ast . IdentifierPath
273- | ast . YulParameters
274- | ast . YulVariableNames
275- | ast . YulArguments
276- | ast . YulPaths
277- | ast . YulPath ;
61+ // This the union of all the types in the namespace `ast`.
62+ type TypeOfAst = typeof ast ;
63+ type KeyOfAst = keyof TypeOfAst ;
64+ type ValuesOf < E > = E [ keyof E ] ;
65+
66+ type SlangAstNode = { [ k in KeyOfAst ] : ValuesOf < TypeOfAst [ k ] > } [ KeyOfAst ] ;
0 commit comments