Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable names are not recorded in for blocks #17

Closed
dodie opened this issue Oct 8, 2016 · 1 comment
Closed

Variable names are not recorded in for blocks #17

dodie opened this issue Oct 8, 2016 · 1 comment

Comments

@dodie
Copy link
Owner

dodie commented Oct 8, 2016

If the for block has an increment statement, the state of the variables inside the block are recorded, but not their name.

For example in the following case the name of the variable j is not recorded:

  47|      @Test
  48|      public void for_test() throws Exception {
  49|          for (int i = 0; i < 10; i++) {  // i=0
  50|              int j = i * 2;  // 0
  51|*             fail();  // AssertionError
  52|          }
  53|      }

But with an empty increment statementthe recording works fine:

  47|      @Test
  48|      public void for_test() throws Exception {
  49|          for (int i = 0; i < 10;) {  // i=0
  50|              int j = i * 2;  // j=0
  51|*             fail();  // AssertionError
  52|          }
  53|      }
@dodie dodie changed the title Sometimes variable names are not recorded in for blocks Variable names are not recorded in for blocks Oct 8, 2016
@dodie
Copy link
Owner Author

dodie commented Oct 9, 2016

Turns out, sometimes the end label of a variable is for an earlier line number than the start label.
Fixed scope calculation to handle this case.

dodie added a commit that referenced this issue Oct 9, 2016
sometimes the end label of a variable is for an earlier line number than the start label.
Fixed scope calculation to handle this case.
@dodie dodie closed this as completed Oct 9, 2016
@dodie dodie modified the milestone: 2.0 Oct 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant