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

Make resolveToValue consider assignments to identifiers (fixes #58) #128

Merged
merged 2 commits into from
Sep 28, 2016
Merged

Make resolveToValue consider assignments to identifiers (fixes #58) #128

merged 2 commits into from
Sep 28, 2016

Conversation

fkling
Copy link
Member

@fkling fkling commented Sep 28, 2016

In the following example, resolveToValue wouldn't resolve to the value
assigned to "React" because it only looks at the variable
definition, not at assignments to the variable:

var React;
React = require('react');
module.exports = React.createClass(...);

This diff fixes that. It will make a shallow traversal over the scope
where the variable is defined and look for the last assignment to the
variable.


I'm also trying to improve tests by storing component definitions that
are known to have been broken in src/__tests__/fixtures/. Adding more
components over time will strengthen the test suit and help catch
regressions.

Also updates to jest v15.

See https://facebook.github.io/jest/blog/2016/09/01/jest-15.html for
details what changed.

I only did some minimal cleanup to make all tests pass.
In the following example, resolveToValue wouldn't resolve to the value
assigned to "React" because it only looks at the variable
definition, not at assignments to the variable:

```
var React;
React = require('react');
module.exports = React.createClass(...);
```

This diff fixes that. It will make a shallow traversal over the scope
where the variable is defined and look for the last assignment to the
variable.

---

I'm also trying to improve tests by storing component definitions that
are known to have been broken in `src/__tests__/fixtures/`. Adding more
components over time will strengthen the test suit and help catch
regressions.
Copy link
Member

@wbinnssmith wbinnssmith left a comment

Choose a reason for hiding this comment

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

lgtm!

@fkling fkling merged commit 1f3cac2 into reactjs:master Sep 28, 2016
@fkling fkling deleted the fix_declaration_resolver branch September 28, 2016 23:08
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants