@solidity-parser/parser
Advanced tools
Comparing version 0.13.3-rc.0 to 0.13.3-rc.1
@@ -20,3 +20,4 @@ import { ASTNode, ASTVisitor, SourceUnit } from './ast-types'; | ||
export declare function parse(input: string, options?: ParseOptions): ParseResult; | ||
export declare function visitAll(node: unknown, cb: (node: ASTNode, nodeParent?: ASTNode) => boolean, nodeParent?: ASTNode): void; | ||
export declare function visit(node: unknown, visitor: ASTVisitor, nodeParent?: ASTNode): void; | ||
export {}; |
{ | ||
"name": "@solidity-parser/parser", | ||
"version": "0.13.3-rc.0", | ||
"version": "0.13.3-rc.1", | ||
"description": "A Solidity parser built from a robust ANTLR 4 grammar", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -1568,3 +1568,3 @@ import { ParserRuleContext } from 'antlr4ts' | ||
path, | ||
pathLiteral, | ||
pathLiteral: this._addMeta(pathLiteral, ctx.importPath()), | ||
unitAlias, | ||
@@ -1571,0 +1571,0 @@ unitAliasIdentifier, |
@@ -107,2 +107,26 @@ import { ANTLRInputStream, CommonTokenStream } from 'antlr4ts' | ||
export function visitAll(node: unknown, cb: (node: ASTNode, nodeParent?: ASTNode) => boolean, nodeParent?: ASTNode): void { | ||
if (Array.isArray(node)) { | ||
node.forEach((child) => visitAll(child, cb, nodeParent)) | ||
} | ||
if (!_isASTNode(node)) return | ||
if (node.loc === undefined) { | ||
console.trace() | ||
process.exit(1) | ||
} | ||
const cont = cb(node, nodeParent) | ||
if (cont === false) return | ||
for (const prop in node) { | ||
if (Object.prototype.hasOwnProperty.call(node, prop)) { | ||
// TODO can we avoid this `as any` | ||
visitAll((node as any)[prop], cb, node) | ||
} | ||
} | ||
} | ||
export function visit(node: unknown, visitor: ASTVisitor, nodeParent?: ASTNode): void { | ||
@@ -109,0 +133,0 @@ if (Array.isArray(node)) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9173407
97584