Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

Commit

Permalink
Update typings for FunctionCall and MemberAccess. Change type of iden…
Browse files Browse the repository at this point in the history
…tifier from string to Identifier.
  • Loading branch information
aoli-al authored and federicobond committed Apr 29, 2019
1 parent 663aa91 commit f0ef770
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export type ASTNodeTypeString =
| 'ExpressionList'
| 'NameValueList'
| 'NameValue'
| 'FunctionCall'
| 'FunctionCallArguments'
| 'AssemblyBlock'
| 'AssemblyItem'
Expand Down Expand Up @@ -93,6 +94,7 @@ export type ASTNodeTypeString =
| 'Conditional'
| 'StringLiteral'
| 'HexLiteral'
| 'MemberAccess'
| 'IndexAccess';
export interface BaseASTNode {
type: ASTNodeTypeString;
Expand Down Expand Up @@ -229,7 +231,7 @@ export interface IfStatement extends BaseASTNode {
type: 'IfStatement';
condition: Expression;
trueBody: Statement;
falseBody: Statement;
falseBody?: Statement;
}
export interface WhileStatement extends BaseASTNode {
type: 'WhileStatement';
Expand Down Expand Up @@ -258,7 +260,7 @@ export interface ThrowStatement extends BaseASTNode {
export interface VariableDeclarationStatement extends BaseASTNode {
type: 'VariableDeclarationStatement';
variables: ASTNode[];
initialValue: Expression;
initialValue?: Expression;
}
export interface IdentifierList extends BaseASTNode {
type: 'IdentifierList';
Expand All @@ -276,6 +278,11 @@ export interface NameValueList extends BaseASTNode {
export interface NameValue extends BaseASTNode {
type: 'NameValue';
}
export interface FunctionCall extends BaseASTNode {
type: 'FunctionCall';
expression: Expression;
arguments: FunctionCallArguments[];
}
export interface FunctionCallArguments extends BaseASTNode {
type: 'FunctionCallArguments';
}
Expand Down Expand Up @@ -338,7 +345,7 @@ export interface ElementaryTypeNameExpression extends BaseASTNode {
}
export interface NumberLiteral extends BaseASTNode {
type: 'NumberLiteral';
number: number;
number: string;
subdenomination:
| null
| 'wei'
Expand Down Expand Up @@ -401,8 +408,8 @@ export type BinOp =
| '%=';
export interface BinaryOperation extends BaseASTNode {
type: 'BinaryOperation';
left: ASTNode;
right: ASTNode;
left: Expression;
right: Expression;
operator: BinOp;
}
export interface Conditional extends BaseASTNode {
Expand All @@ -412,8 +419,13 @@ export interface Conditional extends BaseASTNode {
}
export interface IndexAccess extends BaseASTNode {
type: 'IndexAccess';
base: ASTNode;
index: ASTNode
base: Expression;
index: Expression;
}
export interface MemberAccess extends BaseASTNode {
type: 'MemberAccess';
expression: Expression;
memberName: string;
}
export type ASTNode =
| SourceUnit
Expand Down Expand Up @@ -496,6 +508,7 @@ export type Expression =
| TupleExpression
| BinaryOperation
| Conditional
| MemberAccess
| PrimaryExpression;
export type PrimaryExpression =
| BooleanLiteral
Expand Down Expand Up @@ -596,10 +609,12 @@ export interface Visitor {
TupleExpression?: (node: TupleExpression) => any;
ElementaryTypeNameExpression?: (node: ElementaryTypeNameExpression) => any;
NumberLiteral?: (node: NumberLiteral) => any;
BooleanLiteral?: (node: BooleanLiteral) => any;
Identifier?: (node: Identifier) => any;
BinaryOperation?: (node: BinaryOperation) => any;
Conditional?: (node: Conditional) => any;
IndexAccess?: (node: IndexAccess) => any;
MemberAccess?: (node: MemberAccess) => any;
// Start of :exit handler for each type. Must be consistent with above
'SourceUnit:exit'?: (node: SourceUnit) => any;
'PragmaDirective:exit'?: (node: PragmaDirective) => any;
Expand Down Expand Up @@ -678,10 +693,12 @@ export interface Visitor {
node: ElementaryTypeNameExpression
) => any;
'NumberLiteral:exit'?: (node: NumberLiteral) => any;
'BooleanLiteral:exit'?: (node: BooleanLiteral) => any;
'Identifier:exit'?: (node: Identifier) => any;
'BinaryOperation:exit'?: (node: BinaryOperation) => any;
'Conditional:exit'?: (node: Conditional) => any;
'IndexAccess:exit'?: (node: IndexAccess) => any;
'MemberAccess:exit'?: (node: MemberAccess) => any;
}
export interface ParserOpts {
tolerant?: boolean;
Expand Down

0 comments on commit f0ef770

Please sign in to comment.