diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2019-01-15 21:45:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-15 21:45:02 +0800 |
commit | 18084588ea9fa724d6e32c9a49c79d49f189ba7c (patch) | |
tree | 7944152430a9687e7e63db4011bacaf2fa3aebe3 /packages/sol-tracing-utils/src/get_source_range_snippet.ts | |
parent | 16a2cf7be68605def2824de4f5c22f0154c2e6ad (diff) | |
parent | 64d99dc07cc82c7cc2917871596b46985f1d709f (diff) | |
download | dexon-0x-contracts-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar dexon-0x-contracts-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.gz dexon-0x-contracts-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.bz2 dexon-0x-contracts-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.lz dexon-0x-contracts-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.xz dexon-0x-contracts-18084588ea9fa724d6e32c9a49c79d49f189ba7c.tar.zst dexon-0x-contracts-18084588ea9fa724d6e32c9a49c79d49f189ba7c.zip |
Merge pull request #1498 from 0xProject/fix/sol-cov
Sol tracing fixes
Diffstat (limited to 'packages/sol-tracing-utils/src/get_source_range_snippet.ts')
-rw-r--r-- | packages/sol-tracing-utils/src/get_source_range_snippet.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/sol-tracing-utils/src/get_source_range_snippet.ts b/packages/sol-tracing-utils/src/get_source_range_snippet.ts index f578675d3..7aef00fee 100644 --- a/packages/sol-tracing-utils/src/get_source_range_snippet.ts +++ b/packages/sol-tracing-utils/src/get_source_range_snippet.ts @@ -13,7 +13,7 @@ interface ASTInfo { } // Parsing source code for each transaction/code is slow and therefore we cache it -const parsedSourceByHash: { [sourceHash: string]: Parser.ASTNode } = {}; +const hashToParsedSource: { [sourceHash: string]: Parser.ASTNode } = {}; /** * Gets the source range snippet by source range to be used by revert trace. @@ -22,10 +22,10 @@ const parsedSourceByHash: { [sourceHash: string]: Parser.ASTNode } = {}; */ export function getSourceRangeSnippet(sourceRange: SourceRange, sourceCode: string): SourceSnippet | null { const sourceHash = ethUtil.sha3(sourceCode).toString('hex'); - if (_.isUndefined(parsedSourceByHash[sourceHash])) { - parsedSourceByHash[sourceHash] = Parser.parse(sourceCode, { loc: true }); + if (_.isUndefined(hashToParsedSource[sourceHash])) { + hashToParsedSource[sourceHash] = Parser.parse(sourceCode, { loc: true }); } - const astNode = parsedSourceByHash[sourceHash]; + const astNode = hashToParsedSource[sourceHash]; const visitor = new ASTInfoVisitor(); Parser.visit(astNode, visitor); const astInfo = visitor.getASTInfoForRange(sourceRange); |