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

Made the checks for compiling with the map option more consistent #833

Closed
wants to merge 1 commit into from
Closed

Made the checks for compiling with the map option more consistent #833

wants to merge 1 commit into from

Conversation

msteen
Copy link
Contributor

@msteen msteen commented Jan 31, 2016

No description provided.

@@ -44,7 +44,7 @@ exports <<<
output = new SourceNode null, null, null, [
"// Generated by LiveScript #{exports.VERSION}\n", output
]
if options.map and options.map isnt 'none'
if options.map? and options.map isnt 'none'
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be a string if it's present, not false, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is right, options.map should be a string, 'none', 'embedded', etc. If you now passed options.map = 5, it would be as if it were embedded, my change did not effect this behavior. I only changed it because I thought it to be better LiveScript code to use value? for checking the existence of some value, because it makes the intent clear.

If the code is only for control flow, than how it currently is should suffice. Then you assume the value to be valid. If you also want to do validation, the check would become:if options.map in <[ linked linked-src embedded debug ]>. But than you will have to change a lot more code, because validation of options is currently not being done except for the CLI.

@rhendric
Copy link
Collaborator

rhendric commented Apr 2, 2018

I don't think the refinement in this PR is necessary. If we were to support map: false in options, I would argue that its behavior ought to be the same as map: 'none'.

@rhendric rhendric closed this Apr 2, 2018
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.

3 participants