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

Fix for undefined parent error #111

Merged
merged 2 commits into from Feb 10, 2017

Conversation

Projects
None yet
3 participants
@hsdwayne
Copy link
Contributor

hsdwayne commented Feb 8, 2017

This fixes the error discussed in this comment 74c4723#commitcomment-20790735

Wayne Choy Wayne Choy

hsdwayne referenced this pull request Feb 9, 2017

Add more detailed annotation.
Prior to this, all visualization would show would be `Babel`,
after this change we will have `Babel: <project-or-addon-name>`.
index.js Outdated
@@ -120,7 +120,7 @@ module.exports = {
},

_getBabelOptions: function() {
var parentName = typeof this.parent.name === "function" ? this.parent.name() : this.parent.name;
var parentName = typeof this.parent !== 'undefined' ? (typeof this.parent.name === 'function' ? this.parent.name() : this.parent.name) : 'unknown';

This comment has been minimized.

@rwjblue

rwjblue Feb 9, 2017

Member

Maybe a slight tweak:

var parantName;
if (this.parent && typeof this.parent.name === 'function') {
  parentName = this.parent.name();
} else if (this.parent) {
  parentName = this.parent.name;
}

I find it hard to reason about nested ternaries...

Wayne Choy Wayne Choy
parentName = this.parent.name;
}
}

This comment has been minimized.

@hsdwayne

hsdwayne Feb 9, 2017

Author Contributor

@rwjblue Ok, how's this?

@rwjblue rwjblue merged commit 8f976a8 into babel:master Feb 10, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Turbo87 Turbo87 added the bug label Oct 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment