Skip to content

Commit f9bba29

Browse files
committed
Fix tests
1 parent 68c4f12 commit f9bba29

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

solidity-parser-parser-0.10.0.tgz

-1.32 MB
Binary file not shown.

src/ASTBuilder.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ const transformAST = {
471471
name: toText(ctx.identifier()),
472472
storageLocation,
473473
isStateVar: false,
474-
isIndexed: ctx.IndexedKeyword(0),
474+
isIndexed: !!ctx.IndexedKeyword(0),
475475
}
476476
},
477477

@@ -550,7 +550,7 @@ const transformAST = {
550550

551551
return {
552552
isReasonStringType:
553-
ctx.identifier() && toText(ctx.identifier()) === 'Error',
553+
!!ctx.identifier() && toText(ctx.identifier()) === 'Error',
554554
parameters,
555555
body: (this as any).visit(ctx.block()),
556556
}
@@ -716,6 +716,7 @@ const transformAST = {
716716
typeName: {
717717
type: 'ArrayTypeName',
718718
baseTypeName: (this as any).visit(ctx.getChild(0)),
719+
length: null,
719720
},
720721
}
721722
}
@@ -1189,7 +1190,7 @@ const transformAST = {
11891190
return {
11901191
name: toText(ctx.identifier()),
11911192
parameters: (this as any).visit(ctx.eventParameterList()),
1192-
isAnonymous: ctx.AnonymousKeyword(),
1193+
isAnonymous: !!ctx.AnonymousKeyword(),
11931194
}
11941195
},
11951196

@@ -1207,7 +1208,7 @@ const transformAST = {
12071208
typeName: type,
12081209
name,
12091210
isStateVar: false,
1210-
isIndexed: paramCtx.IndexedKeyword(0),
1211+
isIndexed: !!paramCtx.IndexedKeyword(0),
12111212
},
12121213
paramCtx
12131214
)
@@ -1471,8 +1472,8 @@ class ASTBuilder extends antlr4.tree.ParseTreeVisitor {
14711472
column: ctx.start.column,
14721473
},
14731474
end: {
1474-
line: ctx.stop !== undefined ? ctx.stop.line : ctx.start.line,
1475-
column: ctx.stop !== undefined ? ctx.stop.column : ctx.start.column,
1475+
line: ctx.stop ? ctx.stop.line : ctx.start.line,
1476+
column: ctx.stop ? ctx.stop.column : ctx.start.column,
14761477
},
14771478
}
14781479
return { loc: sourceLocation }

src/ast-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export interface UserDefinedTypeName extends BaseASTNode {
202202
export interface ArrayTypeName extends BaseASTNode {
203203
type: 'ArrayTypeName'
204204
baseTypeName: TypeName
205-
length?: Expression
205+
length: Expression | null
206206
}
207207
export interface Mapping extends BaseASTNode {
208208
type: 'Mapping'

test/ast.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { assert } = require('chai')
2-
const parser = require('../dist/index')
2+
const parser = require('..')
33
const {
44
parseContract,
55
parseNode,

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const fs = require('fs')
22
const { assert } = require('chai')
3-
const parser = require('../dist/index')
3+
const parser = require('..')
44
const { parseNode, parseStatement } = require('./utils')
55

66
describe('#parse', function () {

test/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { assert } = require('chai')
2-
const parser = require('../dist/index')
2+
const parser = require('..')
33

44
function print(obj) {
55
console.log(JSON.stringify(obj, null, 2))

0 commit comments

Comments
 (0)