JoinColony / solcover

Code coverage for solidity
MIT License
64 stars 8 forks source link

Fix injection issue for else's without brackets #5

Closed cgewecke closed 7 years ago

cgewecke commented 7 years ago

At present, unbracketed else consequents get broken because the coverage statement is injected one character too far. Example:

if (x==1)
  throw;
else 
  x = 5;

errors with:

Error: Instrumented solidity invalid: :14:48: Error: Expected primary expression.
              xBranchCoverage('test.sol',1,1); = 5;

This PR adds bracket management logic that currently exists for the if statement to the else statement.