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

Validate whether a file defined a label multiple times during assembly #25

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

tomaz-suller
Copy link
Collaborator

Fixes #24.

Current behaviour, as described in the issue, is

$ cargo run --bin mvn-assembler -- <<EOF
FOO LV /0
FOO LV /5
BAR LD FOO
EOF
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/mvn-assembler`
0000 3000
0002 3005
0004 8002

This PR changes this behaviour to

$ cargo run --bin mvn-assembler -- <<EOF
FOO LV /0
FOO LV /5
BAR LD FOO
EOF
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/mvn-assembler`
error: error while handling input file
  |
2 | FOO LV /5
  |  ^ label was already defined
  |

This allows for a cleaner API using `clone()` on iterators over types
we know are not expensive to clone (such as a `Label`).
Also add unit tests to avoid future regression.
}
}
}
Ok(())
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guissalustiano você acha que isso fica melhor com iterator? Eu tentei fazer mas acabei me enrolando porque tem efeitos colaterais no meio, e porque mesmo o método mais próximo do que eu queria fazer (try_fold) não suportada mencionar o elemento anterior ao erro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicated label not throw erros and remove line
1 participant