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.
This commit is contained in:
Xiao Liang
2019-02-11 21:30:12 +08:00
committed by GitHub
parent b45d238cec
commit 2e8330c53a
+82 -82
View File
@@ -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;