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

Support switch complexity #11

Open
richierocks opened this issue May 25, 2016 · 1 comment
Open

Support switch complexity #11

richierocks opened this issue May 25, 2016 · 1 comment

Comments

@richierocks
Copy link
Contributor

I expected this to return 6, but I get 1:

cyclocomp(quote(switch("e", a = 1, b = 2, c = 3, d = 4, e = 5, 6)))

I think calls to switch ought to return the number of non-missing elements of ....

In this example, a and b resolve to the same thing, so there are only 2 paths through the code:

switch("a", a = , b = 2, c = 3)
@gaborcsardi
Copy link
Contributor

Thanks, that's definitely a good idea.

In general, we cannot really detect if a function is computing on the language and then conditionally executes code, but at least we can handle the built-in ones.

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

No branches or pull requests

2 participants