SyntaxError:Strict mode does not allow function declaration in a lexically nested statement
Original issue submitted by @wrbing728 in https://github.com/babel/babel/issues/9980
Bug Report
Current Behavior
Just see the nodent below, async/await was transformed to block-scope function, which is not supported in iOS9.x

Input Code

http://nodent.mailed.me.uk/#const%20wait%20%3D%20async%20param%20%3D%3E%20param%3B%0A%0Aconst%20blockScopeFun%20%3D%20async%20param%20%3D%3E%20%7B%0A%20%20try%20%7B%0A%20%20%20%20if%20(param)%20%7B%0A%20%20%20%20%20%20await%20wait()%3B%0A%20%20%20%20%7D%0A%20%20%7D%20catch(error)%20%7B%0A%20%20%20%20console.log(error)%3B%0A%20%20%7D%0A%7D%3B~options~%7B%22mode%22%3A%22promises%22%2C%22promiseType%22%3A%22Zousan%22%2C%22noRuntime%22%3Afalse%2C%22es6target%22%3Afalse%2C%22wrapAwait%22%3Atrue%2C%22spec%22%3Afalse%7D
Expected behavior/code Expect the generated result to be compatible with low version of iOS. Like this:
var wait = function wait(param) {
return _await(param);
};
var blockScopeFun = _async(function (param) {
return _continueIgnored(_catch(function () {
return _invokeIgnored(function () {
if (param) {
return _callIgnored(wait);
}
});
}, function (error) {
console.log(error);
}));
});