Skip to content

Commit

Permalink
Note updated getFunctionParent behaviour (#1286)
Browse files Browse the repository at this point in the history
* Note updated getFunctionParent behaviour

* docs: add risk of breakage badge

* Update 2017-03-01-upgrade-to-babel-7-for-tool-authors.md
  • Loading branch information
sarupbanskota authored and hzoo committed Aug 2, 2017
1 parent f312411 commit 97942ff
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions _posts/2017-03-01-upgrade-to-babel-7-for-tool-authors.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,17 @@ babylon.parse(code, {
See Babylon's [plugin options](https://babeljs.io/docs/core-packages/babylon/#api-plugins).

> Removed `classConstructorCall` plugin [#291](https://github.com/babel/babylon/pull/291) ![low](https://img.shields.io/badge/risk%20of%20breakage%3F-low-yellowgreen.svg)

## `babel-traverse`

`getFunctionParent` will no longer return `Program`, please use `getProgramParent` instead [babel/babel#5923](https://github.com/babel/babel/pull/5923). ![low](https://img.shields.io/badge/risk%20of%20breakage%3F-low-yellowgreen.svg)

It doesn't make sense that a function named `getFunctionParent` also returns the Program, so that was removed.

To get the equivalent behavior, you'll need to make a change like

```diff
- path.scope.getFunctionParent()
+ path.scope.getFunctionParent() || path.scope.getProgramParent()
```

0 comments on commit 97942ff

Please sign in to comment.