Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/instrumenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ class Instrumenter {

// Walk the AST, recording injection points
ast = SolidityParser.parse(contract.instrumented, {range: true});
contract.contractName = ast.children.filter(node => this._isRootNode(node))[0].name;

const root = ast.children.filter(node => this._isRootNode(node));

// Handle contracts which only contain import statements
contract.contractName = (root.length) ? root[0].name : null;
parse[ast.type](contract, ast);

// We have to iterate through these points in descending order
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pragma solidity >=0.4.21 <0.6.0;

import "package/AnotherImport.sol";

interface Void {}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.