From f203e285940845f8047208532ad2840a8efbca8f Mon Sep 17 00:00:00 2001 From: Xiao Liang Date: Mon, 11 Feb 2019 02:55:44 +0800 Subject: [PATCH 1/4] solidity-parser-antlr: fix multiple type definitions --- types/solidity-parser-antlr/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/solidity-parser-antlr/index.d.ts b/types/solidity-parser-antlr/index.d.ts index 062a4ed918..e0917b1fbd 100644 --- a/types/solidity-parser-antlr/index.d.ts +++ b/types/solidity-parser-antlr/index.d.ts @@ -18,7 +18,9 @@ export interface BaseASTNode { range?: [number, number]; loc?: Location; } -export interface SourceUnit extends BaseASTNode {} // tslint:disable-line:no-empty-interface +export interface SourceUnit extends BaseASTNode { + children: ASTNode[]; // TODO: Can be more precise +} // tslint:disable-line:no-empty-interface export interface PragmaDirective extends BaseASTNode {} // tslint:disable-line:no-empty-interface export interface PragmaName extends BaseASTNode {} // tslint:disable-line:no-empty-interface export interface PragmaValue extends BaseASTNode {} // tslint:disable-line:no-empty-interface @@ -29,6 +31,7 @@ export interface ImportDeclaration extends BaseASTNode {} // tslint:disable-line export interface ImportDirective extends BaseASTNode {} // tslint:disable-line:no-empty-interface export interface ContractDefinition extends BaseASTNode { name: string; + subNodes: ASTNode[]; // TODO: Can be more precise } export interface InheritanceSpecifier extends BaseASTNode {} // tslint:disable-line:no-empty-interface export interface ContractPart extends BaseASTNode {} // tslint:disable-line:no-empty-interface @@ -45,6 +48,8 @@ export interface ModifierInvocation extends BaseASTNode { } export interface FunctionDefinition extends BaseASTNode { name: string; + parameters: ParameterList; + body: Block | null; } export interface ReturnParameters extends BaseASTNode {} // tslint:disable-line:no-empty-interface export interface ModifierList extends BaseASTNode {} // tslint:disable-line:no-empty-interface From b45d238cece73e5528b27c60aaa781cfc6fcc72f Mon Sep 17 00:00:00 2001 From: Xiao Liang Date: Mon, 11 Feb 2019 03:15:52 +0800 Subject: [PATCH 2/4] fix(solidity-parser-antlr): fix visitor definition The visitor's return value should really be that `false | any` which is equal to `any`. See https://github.com/federicobond/solidity-parser-antlr/blob/73c6818452ba2eb50338b6a857acb82e976c34be/src/index.js#L97 . Current master version of `solidity-parser-antlr` only cares whether it's `false`. --- types/solidity-parser-antlr/index.d.ts | 164 ++++++++++++------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/types/solidity-parser-antlr/index.d.ts b/types/solidity-parser-antlr/index.d.ts index e0917b1fbd..7b92aefb22 100644 --- a/types/solidity-parser-antlr/index.d.ts +++ b/types/solidity-parser-antlr/index.d.ts @@ -246,88 +246,88 @@ export type ASTNode = | BinaryOperation | Conditional; export interface Visitor { - SourceUnit?: (node: SourceUnit) => void; - PragmaDirective?: (node: PragmaDirective) => void; - PragmaName?: (node: PragmaName) => void; - PragmaValue?: (node: PragmaValue) => void; - Version?: (node: Version) => void; - VersionOperator?: (node: VersionOperator) => void; - VersionConstraint?: (node: VersionConstraint) => void; - ImportDeclaration?: (node: ImportDeclaration) => void; - ImportDirective?: (node: ImportDirective) => void; - ContractDefinition?: (node: ContractDefinition) => void; - InheritanceSpecifier?: (node: InheritanceSpecifier) => void; - ContractPart?: (node: ContractPart) => void; - StateVariableDeclaration?: (node: StateVariableDeclaration) => void; - UsingForDeclaration?: (node: UsingForDeclaration) => void; - StructDefinition?: (node: StructDefinition) => void; - ModifierDefinition?: (node: ModifierDefinition) => void; - ModifierInvocation?: (node: ModifierInvocation) => void; - FunctionDefinition?: (node: FunctionDefinition) => void; - ReturnParameters?: (node: ReturnParameters) => void; - ModifierList?: (node: ModifierList) => void; - EventDefinition?: (node: EventDefinition) => void; - EnumValue?: (node: EnumValue) => void; - EnumDefinition?: (node: EnumDefinition) => void; - ParameterList?: (node: ParameterList) => void; - Parameter?: (node: Parameter) => void; - EventParameterList?: (node: EventParameterList) => void; - EventParameter?: (node: EventParameter) => void; - FunctionTypeParameterList?: (node: FunctionTypeParameterList) => void; - FunctionTypeParameter?: (node: FunctionTypeParameter) => void; - VariableDeclaration?: (node: VariableDeclaration) => void; - TypeName?: (node: TypeName) => void; - UserDefinedTypeName?: (node: UserDefinedTypeName) => void; - Mapping?: (node: Mapping) => void; - FunctionTypeName?: (node: FunctionTypeName) => void; - StorageLocation?: (node: StorageLocation) => void; - StateMutability?: (node: StateMutability) => void; - Block?: (node: Block) => void; - Statement?: (node: Statement) => void; - ExpressionStatement?: (node: ExpressionStatement) => void; - IfStatement?: (node: IfStatement) => void; - WhileStatement?: (node: WhileStatement) => void; - SimpleStatement?: (node: SimpleStatement) => void; - ForStatement?: (node: ForStatement) => void; - InlineAssemblyStatement?: (node: InlineAssemblyStatement) => void; - DoWhileStatement?: (node: DoWhileStatement) => void; - ContinueStatement?: (node: ContinueStatement) => void; - BreakStatement?: (node: BreakStatement) => void; - ReturnStatement?: (node: ReturnStatement) => void; - ThrowStatement?: (node: ThrowStatement) => void; - VariableDeclarationStatement?: (node: VariableDeclarationStatement) => void; - IdentifierList?: (node: IdentifierList) => void; - ElementaryTypeName?: (node: ElementaryTypeName) => void; - Expression?: (node: Expression) => void; - PrimaryExpression?: (node: PrimaryExpression) => void; - ExpressionList?: (node: ExpressionList) => void; - NameValueList?: (node: NameValueList) => void; - NameValue?: (node: NameValue) => void; - FunctionCallArguments?: (node: FunctionCallArguments) => void; - AssemblyBlock?: (node: AssemblyBlock) => void; - AssemblyItem?: (node: AssemblyItem) => void; - AssemblyExpression?: (node: AssemblyExpression) => void; - AssemblyCall?: (node: AssemblyCall) => void; - AssemblyLocalDefinition?: (node: AssemblyLocalDefinition) => void; - AssemblyAssignment?: (node: AssemblyAssignment) => void; - AssemblyIdentifierOrList?: (node: AssemblyIdentifierOrList) => void; - AssemblyIdentifierList?: (node: AssemblyIdentifierList) => void; - AssemblyStackAssignment?: (node: AssemblyStackAssignment) => void; - LabelDefinition?: (node: LabelDefinition) => void; - AssemblySwitch?: (node: AssemblySwitch) => void; - AssemblyCase?: (node: AssemblyCase) => void; - AssemblyFunctionDefinition?: (node: AssemblyFunctionDefinition) => void; - AssemblyFunctionReturns?: (node: AssemblyFunctionReturns) => void; - AssemblyFor?: (node: AssemblyFor) => void; - AssemblyIf?: (node: AssemblyIf) => void; - AssemblyLiteral?: (node: AssemblyLiteral) => void; - SubAssembly?: (node: SubAssembly) => void; - TupleExpression?: (node: TupleExpression) => void; - ElementaryTypeNameExpression?: (node: ElementaryTypeNameExpression) => void; - NumberLiteral?: (node: NumberLiteral) => void; - Identifier?: (node: Identifier) => void; - BinaryOperation?: (node: BinaryOperation) => void; - Conditional?: (node: Conditional) => void; + SourceUnit?: (node: SourceUnit) => any; + PragmaDirective?: (node: PragmaDirective) => any; + PragmaName?: (node: PragmaName) => any; + PragmaValue?: (node: PragmaValue) => any; + Version?: (node: Version) => any; + VersionOperator?: (node: VersionOperator) => any; + VersionConstraint?: (node: VersionConstraint) => any; + ImportDeclaration?: (node: ImportDeclaration) => any; + ImportDirective?: (node: ImportDirective) => any; + ContractDefinition?: (node: ContractDefinition) => any; + InheritanceSpecifier?: (node: InheritanceSpecifier) => any; + ContractPart?: (node: ContractPart) => any; + StateVariableDeclaration?: (node: StateVariableDeclaration) => any; + UsingForDeclaration?: (node: UsingForDeclaration) => any; + StructDefinition?: (node: StructDefinition) => any; + ModifierDefinition?: (node: ModifierDefinition) => any; + ModifierInvocation?: (node: ModifierInvocation) => any; + FunctionDefinition?: (node: FunctionDefinition) => any; + ReturnParameters?: (node: ReturnParameters) => any; + ModifierList?: (node: ModifierList) => any; + EventDefinition?: (node: EventDefinition) => any; + EnumValue?: (node: EnumValue) => any; + EnumDefinition?: (node: EnumDefinition) => any; + ParameterList?: (node: ParameterList) => any; + Parameter?: (node: Parameter) => any; + EventParameterList?: (node: EventParameterList) => any; + EventParameter?: (node: EventParameter) => any; + FunctionTypeParameterList?: (node: FunctionTypeParameterList) => any; + FunctionTypeParameter?: (node: FunctionTypeParameter) => any; + VariableDeclaration?: (node: VariableDeclaration) => any; + TypeName?: (node: TypeName) => any; + UserDefinedTypeName?: (node: UserDefinedTypeName) => any; + Mapping?: (node: Mapping) => any; + FunctionTypeName?: (node: FunctionTypeName) => any; + StorageLocation?: (node: StorageLocation) => any; + StateMutability?: (node: StateMutability) => any; + Block?: (node: Block) => any; + Statement?: (node: Statement) => any; + ExpressionStatement?: (node: ExpressionStatement) => any; + IfStatement?: (node: IfStatement) => any; + WhileStatement?: (node: WhileStatement) => any; + SimpleStatement?: (node: SimpleStatement) => any; + ForStatement?: (node: ForStatement) => any; + InlineAssemblyStatement?: (node: InlineAssemblyStatement) => any; + DoWhileStatement?: (node: DoWhileStatement) => any; + ContinueStatement?: (node: ContinueStatement) => any; + BreakStatement?: (node: BreakStatement) => any; + ReturnStatement?: (node: ReturnStatement) => any; + ThrowStatement?: (node: ThrowStatement) => any; + VariableDeclarationStatement?: (node: VariableDeclarationStatement) => any; + IdentifierList?: (node: IdentifierList) => any; + ElementaryTypeName?: (node: ElementaryTypeName) => any; + Expression?: (node: Expression) => any; + PrimaryExpression?: (node: PrimaryExpression) => any; + ExpressionList?: (node: ExpressionList) => any; + NameValueList?: (node: NameValueList) => any; + NameValue?: (node: NameValue) => any; + FunctionCallArguments?: (node: FunctionCallArguments) => any; + AssemblyBlock?: (node: AssemblyBlock) => any; + AssemblyItem?: (node: AssemblyItem) => any; + AssemblyExpression?: (node: AssemblyExpression) => any; + AssemblyCall?: (node: AssemblyCall) => any; + AssemblyLocalDefinition?: (node: AssemblyLocalDefinition) => any; + AssemblyAssignment?: (node: AssemblyAssignment) => any; + AssemblyIdentifierOrList?: (node: AssemblyIdentifierOrList) => any; + AssemblyIdentifierList?: (node: AssemblyIdentifierList) => any; + AssemblyStackAssignment?: (node: AssemblyStackAssignment) => any; + LabelDefinition?: (node: LabelDefinition) => any; + AssemblySwitch?: (node: AssemblySwitch) => any; + AssemblyCase?: (node: AssemblyCase) => any; + AssemblyFunctionDefinition?: (node: AssemblyFunctionDefinition) => any; + AssemblyFunctionReturns?: (node: AssemblyFunctionReturns) => any; + AssemblyFor?: (node: AssemblyFor) => any; + AssemblyIf?: (node: AssemblyIf) => any; + AssemblyLiteral?: (node: AssemblyLiteral) => any; + SubAssembly?: (node: SubAssembly) => any; + TupleExpression?: (node: TupleExpression) => any; + ElementaryTypeNameExpression?: (node: ElementaryTypeNameExpression) => any; + NumberLiteral?: (node: NumberLiteral) => any; + Identifier?: (node: Identifier) => any; + BinaryOperation?: (node: BinaryOperation) => any; + Conditional?: (node: Conditional) => any; } export interface ParserOpts { tolerant?: boolean; From 2e8330c53ab072972a13a27b2693fbc0f8fd47df Mon Sep 17 00:00:00 2001 From: Xiao Liang Date: Mon, 11 Feb 2019 21:30:12 +0800 Subject: [PATCH 3/4] solidity-parser-antlr: improve Visitor return type Making `Visitor` return type `=> false | any` rather than `=> any` would make it clearer that `false` is a special return value for the `Visitor`s, if it's not `false`, it doesn't really matter what the value is. --- types/solidity-parser-antlr/index.d.ts | 164 ++++++++++++------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/types/solidity-parser-antlr/index.d.ts b/types/solidity-parser-antlr/index.d.ts index 7b92aefb22..2c50a971a1 100644 --- a/types/solidity-parser-antlr/index.d.ts +++ b/types/solidity-parser-antlr/index.d.ts @@ -246,88 +246,88 @@ export type ASTNode = | BinaryOperation | Conditional; export interface Visitor { - SourceUnit?: (node: SourceUnit) => any; - PragmaDirective?: (node: PragmaDirective) => any; - PragmaName?: (node: PragmaName) => any; - PragmaValue?: (node: PragmaValue) => any; - Version?: (node: Version) => any; - VersionOperator?: (node: VersionOperator) => any; - VersionConstraint?: (node: VersionConstraint) => any; - ImportDeclaration?: (node: ImportDeclaration) => any; - ImportDirective?: (node: ImportDirective) => any; - ContractDefinition?: (node: ContractDefinition) => any; - InheritanceSpecifier?: (node: InheritanceSpecifier) => any; - ContractPart?: (node: ContractPart) => any; - StateVariableDeclaration?: (node: StateVariableDeclaration) => any; - UsingForDeclaration?: (node: UsingForDeclaration) => any; - StructDefinition?: (node: StructDefinition) => any; - ModifierDefinition?: (node: ModifierDefinition) => any; - ModifierInvocation?: (node: ModifierInvocation) => any; - FunctionDefinition?: (node: FunctionDefinition) => any; - ReturnParameters?: (node: ReturnParameters) => any; - ModifierList?: (node: ModifierList) => any; - EventDefinition?: (node: EventDefinition) => any; - EnumValue?: (node: EnumValue) => any; - EnumDefinition?: (node: EnumDefinition) => any; - ParameterList?: (node: ParameterList) => any; - Parameter?: (node: Parameter) => any; - EventParameterList?: (node: EventParameterList) => any; - EventParameter?: (node: EventParameter) => any; - FunctionTypeParameterList?: (node: FunctionTypeParameterList) => any; - FunctionTypeParameter?: (node: FunctionTypeParameter) => any; - VariableDeclaration?: (node: VariableDeclaration) => any; - TypeName?: (node: TypeName) => any; - UserDefinedTypeName?: (node: UserDefinedTypeName) => any; - Mapping?: (node: Mapping) => any; - FunctionTypeName?: (node: FunctionTypeName) => any; - StorageLocation?: (node: StorageLocation) => any; - StateMutability?: (node: StateMutability) => any; - Block?: (node: Block) => any; - Statement?: (node: Statement) => any; - ExpressionStatement?: (node: ExpressionStatement) => any; - IfStatement?: (node: IfStatement) => any; - WhileStatement?: (node: WhileStatement) => any; - SimpleStatement?: (node: SimpleStatement) => any; - ForStatement?: (node: ForStatement) => any; - InlineAssemblyStatement?: (node: InlineAssemblyStatement) => any; - DoWhileStatement?: (node: DoWhileStatement) => any; - ContinueStatement?: (node: ContinueStatement) => any; - BreakStatement?: (node: BreakStatement) => any; - ReturnStatement?: (node: ReturnStatement) => any; - ThrowStatement?: (node: ThrowStatement) => any; - VariableDeclarationStatement?: (node: VariableDeclarationStatement) => any; - IdentifierList?: (node: IdentifierList) => any; - ElementaryTypeName?: (node: ElementaryTypeName) => any; - Expression?: (node: Expression) => any; - PrimaryExpression?: (node: PrimaryExpression) => any; - ExpressionList?: (node: ExpressionList) => any; - NameValueList?: (node: NameValueList) => any; - NameValue?: (node: NameValue) => any; - FunctionCallArguments?: (node: FunctionCallArguments) => any; - AssemblyBlock?: (node: AssemblyBlock) => any; - AssemblyItem?: (node: AssemblyItem) => any; - AssemblyExpression?: (node: AssemblyExpression) => any; - AssemblyCall?: (node: AssemblyCall) => any; - AssemblyLocalDefinition?: (node: AssemblyLocalDefinition) => any; - AssemblyAssignment?: (node: AssemblyAssignment) => any; - AssemblyIdentifierOrList?: (node: AssemblyIdentifierOrList) => any; - AssemblyIdentifierList?: (node: AssemblyIdentifierList) => any; - AssemblyStackAssignment?: (node: AssemblyStackAssignment) => any; - LabelDefinition?: (node: LabelDefinition) => any; - AssemblySwitch?: (node: AssemblySwitch) => any; - AssemblyCase?: (node: AssemblyCase) => any; - AssemblyFunctionDefinition?: (node: AssemblyFunctionDefinition) => any; - AssemblyFunctionReturns?: (node: AssemblyFunctionReturns) => any; - AssemblyFor?: (node: AssemblyFor) => any; - AssemblyIf?: (node: AssemblyIf) => any; - AssemblyLiteral?: (node: AssemblyLiteral) => any; - SubAssembly?: (node: SubAssembly) => any; - TupleExpression?: (node: TupleExpression) => any; - ElementaryTypeNameExpression?: (node: ElementaryTypeNameExpression) => any; - NumberLiteral?: (node: NumberLiteral) => any; - Identifier?: (node: Identifier) => any; - BinaryOperation?: (node: BinaryOperation) => any; - Conditional?: (node: Conditional) => any; + SourceUnit?: (node: SourceUnit) => false | any; + PragmaDirective?: (node: PragmaDirective) => false | any; + PragmaName?: (node: PragmaName) => false | any; + PragmaValue?: (node: PragmaValue) => false | any; + Version?: (node: Version) => false | any; + VersionOperator?: (node: VersionOperator) => false | any; + VersionConstraint?: (node: VersionConstraint) => false | any; + ImportDeclaration?: (node: ImportDeclaration) => false | any; + ImportDirective?: (node: ImportDirective) => false | any; + ContractDefinition?: (node: ContractDefinition) => false | any; + InheritanceSpecifier?: (node: InheritanceSpecifier) => false | any; + ContractPart?: (node: ContractPart) => false | any; + StateVariableDeclaration?: (node: StateVariableDeclaration) => false | any; + UsingForDeclaration?: (node: UsingForDeclaration) => false | any; + StructDefinition?: (node: StructDefinition) => false | any; + ModifierDefinition?: (node: ModifierDefinition) => false | any; + ModifierInvocation?: (node: ModifierInvocation) => false | any; + FunctionDefinition?: (node: FunctionDefinition) => false | any; + ReturnParameters?: (node: ReturnParameters) => false | any; + ModifierList?: (node: ModifierList) => false | any; + EventDefinition?: (node: EventDefinition) => false | any; + EnumValue?: (node: EnumValue) => false | any; + EnumDefinition?: (node: EnumDefinition) => false | any; + ParameterList?: (node: ParameterList) => false | any; + Parameter?: (node: Parameter) => false | any; + EventParameterList?: (node: EventParameterList) => false | any; + EventParameter?: (node: EventParameter) => false | any; + FunctionTypeParameterList?: (node: FunctionTypeParameterList) => false | any; + FunctionTypeParameter?: (node: FunctionTypeParameter) => false | any; + VariableDeclaration?: (node: VariableDeclaration) => false | any; + TypeName?: (node: TypeName) => false | any; + UserDefinedTypeName?: (node: UserDefinedTypeName) => false | any; + Mapping?: (node: Mapping) => false | any; + FunctionTypeName?: (node: FunctionTypeName) => false | any; + StorageLocation?: (node: StorageLocation) => false | any; + StateMutability?: (node: StateMutability) => false | any; + Block?: (node: Block) => false | any; + Statement?: (node: Statement) => false | any; + ExpressionStatement?: (node: ExpressionStatement) => false | any; + IfStatement?: (node: IfStatement) => false | any; + WhileStatement?: (node: WhileStatement) => false | any; + SimpleStatement?: (node: SimpleStatement) => false | any; + ForStatement?: (node: ForStatement) => false | any; + InlineAssemblyStatement?: (node: InlineAssemblyStatement) => false | any; + DoWhileStatement?: (node: DoWhileStatement) => false | any; + ContinueStatement?: (node: ContinueStatement) => false | any; + BreakStatement?: (node: BreakStatement) => false | any; + ReturnStatement?: (node: ReturnStatement) => false | any; + ThrowStatement?: (node: ThrowStatement) => false | any; + VariableDeclarationStatement?: (node: VariableDeclarationStatement) => false | any; + IdentifierList?: (node: IdentifierList) => false | any; + ElementaryTypeName?: (node: ElementaryTypeName) => false | any; + Expression?: (node: Expression) => false | any; + PrimaryExpression?: (node: PrimaryExpression) => false | any; + ExpressionList?: (node: ExpressionList) => false | any; + NameValueList?: (node: NameValueList) => false | any; + NameValue?: (node: NameValue) => false | any; + FunctionCallArguments?: (node: FunctionCallArguments) => false | any; + AssemblyBlock?: (node: AssemblyBlock) => false | any; + AssemblyItem?: (node: AssemblyItem) => false | any; + AssemblyExpression?: (node: AssemblyExpression) => false | any; + AssemblyCall?: (node: AssemblyCall) => false | any; + AssemblyLocalDefinition?: (node: AssemblyLocalDefinition) => false | any; + AssemblyAssignment?: (node: AssemblyAssignment) => false | any; + AssemblyIdentifierOrList?: (node: AssemblyIdentifierOrList) => false | any; + AssemblyIdentifierList?: (node: AssemblyIdentifierList) => false | any; + AssemblyStackAssignment?: (node: AssemblyStackAssignment) => false | any; + LabelDefinition?: (node: LabelDefinition) => false | any; + AssemblySwitch?: (node: AssemblySwitch) => false | any; + AssemblyCase?: (node: AssemblyCase) => false | any; + AssemblyFunctionDefinition?: (node: AssemblyFunctionDefinition) => false | any; + AssemblyFunctionReturns?: (node: AssemblyFunctionReturns) => false | any; + AssemblyFor?: (node: AssemblyFor) => false | any; + AssemblyIf?: (node: AssemblyIf) => false | any; + AssemblyLiteral?: (node: AssemblyLiteral) => false | any; + SubAssembly?: (node: SubAssembly) => false | any; + TupleExpression?: (node: TupleExpression) => false | any; + ElementaryTypeNameExpression?: (node: ElementaryTypeNameExpression) => false | any; + NumberLiteral?: (node: NumberLiteral) => false | any; + Identifier?: (node: Identifier) => false | any; + BinaryOperation?: (node: BinaryOperation) => false | any; + Conditional?: (node: Conditional) => false | any; } export interface ParserOpts { tolerant?: boolean; From ff81a175074a4662d4211e190d65a69b3fdbb06b Mon Sep 17 00:00:00 2001 From: Xiao Liang Date: Mon, 11 Feb 2019 22:34:35 +0800 Subject: [PATCH 4/4] revert(solidity-parser-antlr): improve Visitor return type Since the official DefinitelyTyped/DefinitelyTyped build has `no-any-union` option enabled, changing back to `Visitor` returning `any`. --- types/solidity-parser-antlr/index.d.ts | 164 ++++++++++++------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/types/solidity-parser-antlr/index.d.ts b/types/solidity-parser-antlr/index.d.ts index 2c50a971a1..7b92aefb22 100644 --- a/types/solidity-parser-antlr/index.d.ts +++ b/types/solidity-parser-antlr/index.d.ts @@ -246,88 +246,88 @@ export type ASTNode = | BinaryOperation | Conditional; export interface Visitor { - SourceUnit?: (node: SourceUnit) => false | any; - PragmaDirective?: (node: PragmaDirective) => false | any; - PragmaName?: (node: PragmaName) => false | any; - PragmaValue?: (node: PragmaValue) => false | any; - Version?: (node: Version) => false | any; - VersionOperator?: (node: VersionOperator) => false | any; - VersionConstraint?: (node: VersionConstraint) => false | any; - ImportDeclaration?: (node: ImportDeclaration) => false | any; - ImportDirective?: (node: ImportDirective) => false | any; - ContractDefinition?: (node: ContractDefinition) => false | any; - InheritanceSpecifier?: (node: InheritanceSpecifier) => false | any; - ContractPart?: (node: ContractPart) => false | any; - StateVariableDeclaration?: (node: StateVariableDeclaration) => false | any; - UsingForDeclaration?: (node: UsingForDeclaration) => false | any; - StructDefinition?: (node: StructDefinition) => false | any; - ModifierDefinition?: (node: ModifierDefinition) => false | any; - ModifierInvocation?: (node: ModifierInvocation) => false | any; - FunctionDefinition?: (node: FunctionDefinition) => false | any; - ReturnParameters?: (node: ReturnParameters) => false | any; - ModifierList?: (node: ModifierList) => false | any; - EventDefinition?: (node: EventDefinition) => false | any; - EnumValue?: (node: EnumValue) => false | any; - EnumDefinition?: (node: EnumDefinition) => false | any; - ParameterList?: (node: ParameterList) => false | any; - Parameter?: (node: Parameter) => false | any; - EventParameterList?: (node: EventParameterList) => false | any; - EventParameter?: (node: EventParameter) => false | any; - FunctionTypeParameterList?: (node: FunctionTypeParameterList) => false | any; - FunctionTypeParameter?: (node: FunctionTypeParameter) => false | any; - VariableDeclaration?: (node: VariableDeclaration) => false | any; - TypeName?: (node: TypeName) => false | any; - UserDefinedTypeName?: (node: UserDefinedTypeName) => false | any; - Mapping?: (node: Mapping) => false | any; - FunctionTypeName?: (node: FunctionTypeName) => false | any; - StorageLocation?: (node: StorageLocation) => false | any; - StateMutability?: (node: StateMutability) => false | any; - Block?: (node: Block) => false | any; - Statement?: (node: Statement) => false | any; - ExpressionStatement?: (node: ExpressionStatement) => false | any; - IfStatement?: (node: IfStatement) => false | any; - WhileStatement?: (node: WhileStatement) => false | any; - SimpleStatement?: (node: SimpleStatement) => false | any; - ForStatement?: (node: ForStatement) => false | any; - InlineAssemblyStatement?: (node: InlineAssemblyStatement) => false | any; - DoWhileStatement?: (node: DoWhileStatement) => false | any; - ContinueStatement?: (node: ContinueStatement) => false | any; - BreakStatement?: (node: BreakStatement) => false | any; - ReturnStatement?: (node: ReturnStatement) => false | any; - ThrowStatement?: (node: ThrowStatement) => false | any; - VariableDeclarationStatement?: (node: VariableDeclarationStatement) => false | any; - IdentifierList?: (node: IdentifierList) => false | any; - ElementaryTypeName?: (node: ElementaryTypeName) => false | any; - Expression?: (node: Expression) => false | any; - PrimaryExpression?: (node: PrimaryExpression) => false | any; - ExpressionList?: (node: ExpressionList) => false | any; - NameValueList?: (node: NameValueList) => false | any; - NameValue?: (node: NameValue) => false | any; - FunctionCallArguments?: (node: FunctionCallArguments) => false | any; - AssemblyBlock?: (node: AssemblyBlock) => false | any; - AssemblyItem?: (node: AssemblyItem) => false | any; - AssemblyExpression?: (node: AssemblyExpression) => false | any; - AssemblyCall?: (node: AssemblyCall) => false | any; - AssemblyLocalDefinition?: (node: AssemblyLocalDefinition) => false | any; - AssemblyAssignment?: (node: AssemblyAssignment) => false | any; - AssemblyIdentifierOrList?: (node: AssemblyIdentifierOrList) => false | any; - AssemblyIdentifierList?: (node: AssemblyIdentifierList) => false | any; - AssemblyStackAssignment?: (node: AssemblyStackAssignment) => false | any; - LabelDefinition?: (node: LabelDefinition) => false | any; - AssemblySwitch?: (node: AssemblySwitch) => false | any; - AssemblyCase?: (node: AssemblyCase) => false | any; - AssemblyFunctionDefinition?: (node: AssemblyFunctionDefinition) => false | any; - AssemblyFunctionReturns?: (node: AssemblyFunctionReturns) => false | any; - AssemblyFor?: (node: AssemblyFor) => false | any; - AssemblyIf?: (node: AssemblyIf) => false | any; - AssemblyLiteral?: (node: AssemblyLiteral) => false | any; - SubAssembly?: (node: SubAssembly) => false | any; - TupleExpression?: (node: TupleExpression) => false | any; - ElementaryTypeNameExpression?: (node: ElementaryTypeNameExpression) => false | any; - NumberLiteral?: (node: NumberLiteral) => false | any; - Identifier?: (node: Identifier) => false | any; - BinaryOperation?: (node: BinaryOperation) => false | any; - Conditional?: (node: Conditional) => false | any; + SourceUnit?: (node: SourceUnit) => any; + PragmaDirective?: (node: PragmaDirective) => any; + PragmaName?: (node: PragmaName) => any; + PragmaValue?: (node: PragmaValue) => any; + Version?: (node: Version) => any; + VersionOperator?: (node: VersionOperator) => any; + VersionConstraint?: (node: VersionConstraint) => any; + ImportDeclaration?: (node: ImportDeclaration) => any; + ImportDirective?: (node: ImportDirective) => any; + ContractDefinition?: (node: ContractDefinition) => any; + InheritanceSpecifier?: (node: InheritanceSpecifier) => any; + ContractPart?: (node: ContractPart) => any; + StateVariableDeclaration?: (node: StateVariableDeclaration) => any; + UsingForDeclaration?: (node: UsingForDeclaration) => any; + StructDefinition?: (node: StructDefinition) => any; + ModifierDefinition?: (node: ModifierDefinition) => any; + ModifierInvocation?: (node: ModifierInvocation) => any; + FunctionDefinition?: (node: FunctionDefinition) => any; + ReturnParameters?: (node: ReturnParameters) => any; + ModifierList?: (node: ModifierList) => any; + EventDefinition?: (node: EventDefinition) => any; + EnumValue?: (node: EnumValue) => any; + EnumDefinition?: (node: EnumDefinition) => any; + ParameterList?: (node: ParameterList) => any; + Parameter?: (node: Parameter) => any; + EventParameterList?: (node: EventParameterList) => any; + EventParameter?: (node: EventParameter) => any; + FunctionTypeParameterList?: (node: FunctionTypeParameterList) => any; + FunctionTypeParameter?: (node: FunctionTypeParameter) => any; + VariableDeclaration?: (node: VariableDeclaration) => any; + TypeName?: (node: TypeName) => any; + UserDefinedTypeName?: (node: UserDefinedTypeName) => any; + Mapping?: (node: Mapping) => any; + FunctionTypeName?: (node: FunctionTypeName) => any; + StorageLocation?: (node: StorageLocation) => any; + StateMutability?: (node: StateMutability) => any; + Block?: (node: Block) => any; + Statement?: (node: Statement) => any; + ExpressionStatement?: (node: ExpressionStatement) => any; + IfStatement?: (node: IfStatement) => any; + WhileStatement?: (node: WhileStatement) => any; + SimpleStatement?: (node: SimpleStatement) => any; + ForStatement?: (node: ForStatement) => any; + InlineAssemblyStatement?: (node: InlineAssemblyStatement) => any; + DoWhileStatement?: (node: DoWhileStatement) => any; + ContinueStatement?: (node: ContinueStatement) => any; + BreakStatement?: (node: BreakStatement) => any; + ReturnStatement?: (node: ReturnStatement) => any; + ThrowStatement?: (node: ThrowStatement) => any; + VariableDeclarationStatement?: (node: VariableDeclarationStatement) => any; + IdentifierList?: (node: IdentifierList) => any; + ElementaryTypeName?: (node: ElementaryTypeName) => any; + Expression?: (node: Expression) => any; + PrimaryExpression?: (node: PrimaryExpression) => any; + ExpressionList?: (node: ExpressionList) => any; + NameValueList?: (node: NameValueList) => any; + NameValue?: (node: NameValue) => any; + FunctionCallArguments?: (node: FunctionCallArguments) => any; + AssemblyBlock?: (node: AssemblyBlock) => any; + AssemblyItem?: (node: AssemblyItem) => any; + AssemblyExpression?: (node: AssemblyExpression) => any; + AssemblyCall?: (node: AssemblyCall) => any; + AssemblyLocalDefinition?: (node: AssemblyLocalDefinition) => any; + AssemblyAssignment?: (node: AssemblyAssignment) => any; + AssemblyIdentifierOrList?: (node: AssemblyIdentifierOrList) => any; + AssemblyIdentifierList?: (node: AssemblyIdentifierList) => any; + AssemblyStackAssignment?: (node: AssemblyStackAssignment) => any; + LabelDefinition?: (node: LabelDefinition) => any; + AssemblySwitch?: (node: AssemblySwitch) => any; + AssemblyCase?: (node: AssemblyCase) => any; + AssemblyFunctionDefinition?: (node: AssemblyFunctionDefinition) => any; + AssemblyFunctionReturns?: (node: AssemblyFunctionReturns) => any; + AssemblyFor?: (node: AssemblyFor) => any; + AssemblyIf?: (node: AssemblyIf) => any; + AssemblyLiteral?: (node: AssemblyLiteral) => any; + SubAssembly?: (node: SubAssembly) => any; + TupleExpression?: (node: TupleExpression) => any; + ElementaryTypeNameExpression?: (node: ElementaryTypeNameExpression) => any; + NumberLiteral?: (node: NumberLiteral) => any; + Identifier?: (node: Identifier) => any; + BinaryOperation?: (node: BinaryOperation) => any; + Conditional?: (node: Conditional) => any; } export interface ParserOpts { tolerant?: boolean;