aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-tracing-utils/src/get_source_range_snippet.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2019-01-15 20:33:24 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2019-01-15 20:37:10 +0800
commit63a63543be74d9e8822b7b111aa46350a5f524d8 (patch)
tree054119646cd9994351b67552b4402af009d7fb66 /packages/sol-tracing-utils/src/get_source_range_snippet.ts
parent75a4bbc5f2bf38c2ea8c18f21dc9b54eaf5bb422 (diff)
downloaddexon-sol-tools-63a63543be74d9e8822b7b111aa46350a5f524d8.tar
dexon-sol-tools-63a63543be74d9e8822b7b111aa46350a5f524d8.tar.gz
dexon-sol-tools-63a63543be74d9e8822b7b111aa46350a5f524d8.tar.bz2
dexon-sol-tools-63a63543be74d9e8822b7b111aa46350a5f524d8.tar.lz
dexon-sol-tools-63a63543be74d9e8822b7b111aa46350a5f524d8.tar.xz
dexon-sol-tools-63a63543be74d9e8822b7b111aa46350a5f524d8.tar.zst
dexon-sol-tools-63a63543be74d9e8822b7b111aa46350a5f524d8.zip
Make mapping namings direct
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.ts8
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);