Skip to content

continue statement leads to loops that never complete. #99

Open

Description

@jaredlll08
for i in 0 .. 10 {
	println(i);
	if i % 2 == 0 {
		continue;
	}
	println("not even");
}

produces:

IntRange var10000 = new IntRange(0, 10);
int var3 = var10000.to;
int i = var10000.from;

while(var3 > i) {
    Globals.println(Integer.toString(i));
    if (i % 2 != 0) {
        Globals.println("not even");
        ++i;
    }
}

Activity

  1. kindlich commented on Jun 18, 2022

    @kindlich
    Member

    Probably the JMP instruction is pointing at the wrong label then 🤔 (start of loop body instead of iter-increase)
    Is that only for the for-range iterator or also for others like the list/map/array iterators?

  2. jaredlll08 commented on Nov 21, 2023

    @jaredlll08
    MemberAuthor

    Probably the JMP instruction is pointing at the wrong label then 🤔 (start of loop body instead of iter-increase)

    It is indeed that, it doesn't look like we have a label for the iter increase though

  3. added this to the Refactor milestone on Jun 8, 2024
  4. added
    bugSomething isn't working
    bytecodeAll issues that relate to the generation of Java Bytecode
    on Jun 22, 2024
  5. kindlich commented on Jun 23, 2024

    @kindlich
    Member

    Fixed (for refactor) on #157
    If we need this in the pre-refactor version, we could cherry-pick
    6f32190

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbytecodeAll issues that relate to the generation of Java Bytecode

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions