Do not treat inheritance constructors as branches (#594)

experimental-options
cgewecke 4 years ago
parent 4487a1b5f6
commit 350e699762
  1. 2
      lib/registrar.js
  2. 17
      test/sources/solidity/contracts/modifiers/constructor.sol
  3. 6
      test/units/modifiers.js

@ -129,7 +129,7 @@ class Registrar {
} }
// Add modifier branch coverage // Add modifier branch coverage
if (!this.enabled.modifiers) continue; if (!this.enabled.modifiers || expression.isConstructor) continue;
this.addNewModifierBranch(contract, modifier); this.addNewModifierBranch(contract, modifier);
this._createInjectionPoint( this._createInjectionPoint(

@ -0,0 +1,17 @@
pragma solidity ^0.7.0;
contract Parent {
string public name;
constructor(string memory _name) public {
name = _name;
}
}
contract Test is Parent {
constructor() public Parent("Test") {}
function a() public {
uint x = 5;
}
}

@ -160,4 +160,10 @@ describe('modifiers', () => {
1: 1, 2: 1, 3: 1 1: 1, 2: 1, 3: 1
}); });
}); });
it('should *not* treat constructor inheritance invocations as branches', async function() {
const mapping = await setupAndRun('modifiers/constructor');
assert.deepEqual(mapping[util.filePath].b, {});
});
}); });

Loading…
Cancel
Save