Ensure we always push into a BlockStatement - fixes T3051
This commit is contained in:
parent
53877ec158
commit
d71b59d0cc
14
packages/babel-plugin-transform-class-properties/test/fixtures/regression/T6719/actual.js
vendored
Normal file
14
packages/babel-plugin-transform-class-properties/test/fixtures/regression/T6719/actual.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
function withContext(ComposedComponent) {
|
||||
return class WithContext extends Component {
|
||||
|
||||
static propTypes = {
|
||||
context: PropTypes.shape(
|
||||
{
|
||||
addCss: PropTypes.func,
|
||||
setTitle: PropTypes.func,
|
||||
setMeta: PropTypes.func,
|
||||
}
|
||||
),
|
||||
};
|
||||
};
|
||||
}
|
||||
20
packages/babel-plugin-transform-class-properties/test/fixtures/regression/T6719/expected.js
vendored
Normal file
20
packages/babel-plugin-transform-class-properties/test/fixtures/regression/T6719/expected.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
function withContext(ComposedComponent) {
|
||||
var _class, _temp;
|
||||
|
||||
return _temp = _class = (function (_Component) {
|
||||
babelHelpers.inherits(WithContext, _Component);
|
||||
|
||||
function WithContext() {
|
||||
babelHelpers.classCallCheck(this, WithContext);
|
||||
return babelHelpers.possibleConstructorReturn(this, Object.getPrototypeOf(WithContext).apply(this, arguments));
|
||||
}
|
||||
|
||||
return WithContext;
|
||||
})(Component), _class.propTypes = {
|
||||
context: PropTypes.shape({
|
||||
addCss: PropTypes.func,
|
||||
setTitle: PropTypes.func,
|
||||
setMeta: PropTypes.func
|
||||
})
|
||||
}, _temp;
|
||||
}
|
||||
@ -745,15 +745,15 @@ export default class Scope {
|
||||
path = this.getFunctionParent().path;
|
||||
}
|
||||
|
||||
if (!path.isBlockStatement() && !path.isProgram()) {
|
||||
path = this.getBlockParent().path;
|
||||
}
|
||||
|
||||
if (path.isLoop() || path.isCatchClause() || path.isFunction()) {
|
||||
t.ensureBlock(path.node);
|
||||
path = path.get("body");
|
||||
}
|
||||
|
||||
if (!path.isBlockStatement() && !path.isProgram()) {
|
||||
path = this.getBlockParent().path;
|
||||
}
|
||||
|
||||
let unique = opts.unique;
|
||||
let kind = opts.kind || "var";
|
||||
let blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user