-
Notifications
You must be signed in to change notification settings - Fork 47.8k
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
Parse error is confusing when trying to return two elements #1584
Comments
sophiebits
added a commit
to sophiebits/esprima
that referenced
this issue
May 22, 2014
Fixes facebook/react#1584. Test Plan: npm test
sophiebits
added a commit
to sophiebits/esprima
that referenced
this issue
May 22, 2014
Fixes facebook/react#1584. Test Plan: npm test
facebookarchive/esprima#20 was merged; we can close this after a version bump. |
josephsavona
added a commit
that referenced
this issue
May 15, 2024
Implements an efficient algorithm for computing the dominator (or post dominator) tree of a CFG, following https://www.cs.rice.edu/~keith/Embed/dom.pdf. This is used/tested in the next PR to validate that hooks are called unconditionally. note: I clean up the implementation quite a bit late in the stack in #1584
josephsavona
added a commit
that referenced
this issue
May 15, 2024
React will retry or abort components that throw (depending on a few conditions), so from React's perspective a `throw` statement is not a normal exit node. Thus the Rules of Hooks really have a caveat: the set of hooks that are called _in an execution that returns successfully_ must be consistent. Examples such as the following are therefore allowed: ```javascript function Component(props) { if (props.cond) { throw new Error(...); } useHook(); } ``` By modeling `throw` as an exit node, we rejected cases such as this. This diff changes to not model throws as exit nodes. #1584 changes this to make it an option, since some cases will want to consider throw as an exit node.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(Opening here because esprima-fb apparently doesn't accept issues.)
If you write
then you get "Unexpected identifier" because it tries to parse it as
That is, the
<
of the second div is interpreted as a less than. I think we can give nicer errors here if we disallow the less than operator directly after an XJSElement. I don't think this prevents any real uses but if it did, you could always wrap it in parens:cc @jeffmo @syranide
The text was updated successfully, but these errors were encountered: