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

Add test for reference paths #5296

Merged
merged 1 commit into from Feb 15, 2017
Merged

Conversation

jasonLaster
Copy link
Contributor

Q A
Patch: Bug Fix? no
Major: Breaking Change? no
Minor: New Feature? no
Deprecations? no
Spec Compliancy? no
Tests Added/Pass? yes
Fixed Tickets no
License MIT
Doc PR no
Dependency Changes no

Added a test for referencePath

@mention-bot
Copy link

@jasonLaster, thanks for your PR! By analyzing the history of the files in this pull request, we identified @DrewML, @loganfsmyth and @hzoo to be potential reviewers.

@babel-bot
Copy link
Collaborator

Hey @jasonLaster! It looks like one or more of your builds have failed. I've copied the relevant info below to save you some time.

traverse(ast, {
Identifier: function(path) {
nodePath = path;
_path.stop();
Copy link
Member

Choose a reason for hiding this comment

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

should _path be path?

@babel-bot
Copy link
Collaborator

Hey @jasonLaster! It looks like one or more of your builds have failed. I've copied the relevant info below to save you some time.

@babel-bot
Copy link
Collaborator

Hey @jasonLaster! It looks like one or more of your builds have failed. I've copied the relevant info below to save you some time.

@codecov-io
Copy link

codecov-io commented Feb 10, 2017

Codecov Report

Merging #5296 into master will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff           @@
##           master   #5296   +/-   ##
======================================
  Coverage    89.4%   89.4%           
======================================
  Files         204     204           
  Lines        9916    9916           
  Branches     2670    2670           
======================================
  Hits         8865    8865           
  Misses       1051    1051

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 75ac320...90bf1c4. Read the comment docs.

@hzoo hzoo added the PR: Internal 🏠 A type of pull request used for our changelog categories label Feb 11, 2017
@@ -60,5 +73,13 @@ describe("scope", function () {
_foo2: { }
`).scope.generateUid("foo"), "_foo3");
});

it("reference paths", function() {
const node = getIdentifierPath("function square(n) { return n * n}");
Copy link
Member

Choose a reason for hiding this comment

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

since you are returning a path, should this just be named path?


it("reference paths", function() {
const node = getIdentifierPath("function square(n) { return n * n}");
const referencePaths = node.context.scope.bindings.n.referencePaths;
Copy link
Member

Choose a reason for hiding this comment

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

I actually wondering to myself what the difference betwee straight up path.scope vs path.context.scope then

@jasonLaster
Copy link
Contributor Author

jasonLaster commented Feb 11, 2017 via email


it("reference paths", function() {
const path = getIdentifierPath("function square(n) { return n * n}");
const referencePaths = path.context.scope.bindings.n.referencePaths;
Copy link
Member

Choose a reason for hiding this comment

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

unrelated: I guess we should have some tests for scope.bindings (check that only n is defined as a binding)

const path = getIdentifierPath("function square(n) { return n * n}");
const referencePaths = path.context.scope.bindings.n.referencePaths;
assert.equal(referencePaths.length, 2);
assert.deepEqual(referencePaths[0].node.loc.start, { line: 1, column:28 });
Copy link
Member

Choose a reason for hiding this comment

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

thought we'd have a rule for column:28 spacing

Copy link
Member

Choose a reason for hiding this comment

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

@hzoo hzoo merged commit ff2c24e into babel:master Feb 15, 2017
@hzoo
Copy link
Member

hzoo commented Feb 15, 2017

lgtm, 🎉

existentialism pushed a commit that referenced this pull request May 19, 2017
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants