Ensure we always push into a BlockStatement - fixes T3051

This commit is contained in:
Logan Smyth 2015-12-02 19:29:49 -08:00
parent 53877ec158
commit d71b59d0cc
3 changed files with 38 additions and 4 deletions

View 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,
}
),
};
};
}

View 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;
}

View File

@ -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;