Skip to content

Commit f851b8e

Browse files
committed
generating CollectionNode and BinaryOperation from StrictAstNode instead of naming every single class
1 parent fa6a294 commit f851b8e

3 files changed

Lines changed: 57 additions & 106 deletions

File tree

package-lock.json

Lines changed: 44 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676
"devDependencies": {
7777
"@babel/code-frame": "^7.24.7",
7878
"@types/semver": "^7.5.8",
79-
"@typescript-eslint/eslint-plugin": "^8.1.0",
80-
"@typescript-eslint/parser": "^8.1.0",
79+
"@typescript-eslint/eslint-plugin": "^8.2.0",
80+
"@typescript-eslint/parser": "^8.2.0",
8181
"c8": "^9.1.0",
8282
"cross-env": "^7.0.3",
8383
"eslint": "^8.57.0",

src/slang-nodes/index.d.ts

Lines changed: 11 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -221,20 +221,6 @@ import type { YulVariableDeclarationStatement } from './YulVariableDeclarationSt
221221
import type { YulVariableDeclarationValue } from './YulVariableDeclarationValue';
222222
import type { YulVariableNames } from './YulVariableNames';
223223

224-
export type BinaryOperation =
225-
| AdditiveExpression
226-
| MultiplicativeExpression
227-
| ExponentiationExpression
228-
| AssignmentExpression
229-
| BitwiseAndExpression
230-
| BitwiseOrExpression
231-
| BitwiseXorExpression
232-
| ComparisonExpression
233-
| EqualityExpression
234-
| AndExpression
235-
| OrExpression
236-
| ShiftExpression;
237-
238224
export type FunctionLike =
239225
| ConstructorDefinition
240226
| FallbackFunctionDefinition
@@ -244,52 +230,6 @@ export type FunctionLike =
244230
| ReceiveFunctionDefinition
245231
| UnnamedFunctionDefinition;
246232

247-
export type CollectionNode =
248-
| ArrayValues
249-
| AssemblyFlags
250-
| CallOptions
251-
| CatchClauses
252-
| ConstructorAttributes
253-
| ContractMembers
254-
| EnumMembers
255-
| ErrorParameters
256-
| EventParameters
257-
| FallbackFunctionAttributes
258-
| FunctionAttributes
259-
| FunctionTypeAttributes
260-
| HexStringLiterals
261-
| IdentifierPath
262-
| ImportDeconstructionSymbols
263-
| InheritanceTypes
264-
| InterfaceMembers
265-
| LibraryMembers
266-
| ModifierAttributes
267-
| NamedArguments
268-
| OverridePaths
269-
| Parameters
270-
| PositionalArguments
271-
| ReceiveFunctionAttributes
272-
| SourceUnitMembers
273-
| Statements
274-
| StateVariableAttributes
275-
| StringLiterals
276-
| StructMembers
277-
| TupleDeconstructionElements
278-
| TupleValues
279-
| UnicodeStringLiterals
280-
| UnnamedFunctionAttributes
281-
| UsingDeconstructionSymbols
282-
| VersionExpressionSet
283-
| VersionExpressionSets
284-
| VersionSpecifiers
285-
| YulArguments
286-
| YulParameters
287-
| YulPath
288-
| YulPaths
289-
| YulStatements
290-
| YulSwitchCases
291-
| YulVariableNames;
292-
293233
export type BlockComment = MultiLineComment | MultiLineNatSpecComment;
294234

295235
export type LineComment = SingleLineComment | SingleLineNatSpecComment;
@@ -514,6 +454,17 @@ export type StrictAstNode =
514454
| YulPaths
515455
| YulPath;
516456

457+
export type CollectionNode = Extract<StrictAstNode, { items: unknown[] }>;
458+
459+
export type BinaryOperation = Extract<
460+
StrictAstNode,
461+
{
462+
leftOperand: Expression;
463+
operator: string;
464+
rightOperand: Expression;
465+
}
466+
>;
467+
517468
export type AstNode =
518469
| StrictAstNode
519470
| Comment

0 commit comments

Comments
 (0)