aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-tracing-utils/src/get_source_range_snippet.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2019-01-15 22:13:24 +0800
committerFabio Berger <me@fabioberger.com>2019-01-15 22:13:24 +0800
commit7c37d10d1f93791db75b1622efa775a361965c49 (patch)
tree7017104bea27120661f71701552214dc5efba909 /packages/sol-tracing-utils/src/get_source_range_snippet.ts
parentaffd6170540034c31593a4f36ce1dbacb91b6b3e (diff)
parent18084588ea9fa724d6e32c9a49c79d49f189ba7c (diff)
downloaddexon-sol-tools-7c37d10d1f93791db75b1622efa775a361965c49.tar
dexon-sol-tools-7c37d10d1f93791db75b1622efa775a361965c49.tar.gz
dexon-sol-tools-7c37d10d1f93791db75b1622efa775a361965c49.tar.bz2
dexon-sol-tools-7c37d10d1f93791db75b1622efa775a361965c49.tar.lz
dexon-sol-tools-7c37d10d1f93791db75b1622efa775a361965c49.tar.xz
dexon-sol-tools-7c37d10d1f93791db75b1622efa775a361965c49.tar.zst
dexon-sol-tools-7c37d10d1f93791db75b1622efa775a361965c49.zip
Merge branch 'development' into feature/monorepo-scripts/publishToDockerHub
* development: (87 commits) Update packages/sol-tracing-utils/src/trace_collection_subprovider.ts Make mapping namings direct Remove unused tslint disable Revert "Remove logAsyncErrors hack" Remove logAsyncErrors hack Refactor logAsyncErrors to follow our conventions Export Sources and SourceCodes out of tracing utils Replace console.log with logUtils.log (#1515) strict decoding of return values using generics makerAssetFillAmount -> takerAssetFillAmount Ran prettier Linter Fix build after rebase Style cleanup for Compressed Calldata in Contract Wrappers PR Use simpler `_.find` to locate fillOrderBai Updated dutch auction wrapper Added back abi-gen-wrappers Renamed signatureParser.ts to signature_parser.ts Renamed decode rule `structsAsObjects` to `shouldConvertStructsToObjects` circle build failed. New commit to resubmit job. ...
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);