Skip to content

Conversation

rattrayalex
Copy link

Makes if-expression behavior consistent with ES¿8? do-expression.

@rattrayalex rattrayalex merged commit 8159e93 into master Jun 1, 2017
@rattrayalex rattrayalex deleted the no-return-if-expr branch June 1, 2017 19:47
@@ -0,0 +1,3 @@
{
"throws": "'return' outside of function (4:6)"
}

Choose a reason for hiding this comment

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

(Sorry if this is a duplicate, I tried to leave this comment and it somehow got sucked into the pattern matching discussion.)

I think people are going to be extremely confused by this error message, since the return is definitely not outside of a function. It should probably say something like: 'return' is not allowed in expressions.

This may be an upstream PR to babylon as well, since a doExpression should give that message as well.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, agreed. Wasn't sure how best to do that. I guess a try/catch with rethrow would be easiest but that's a little ugly. Otherwise just add inExpression to state, which is more correct.

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.

2 participants