Fixes CR comments

This commit is contained in:
Tingan Ho
2017-08-02 12:05:10 +02:00
parent dbdbb05c66
commit 192628510f
7 changed files with 22 additions and 28 deletions

View File

@@ -2491,7 +2491,7 @@ namespace ts {
const catchVariable = getGeneratedNameForNode(errorRecord);
const returnMethod = createTempVariable(/*recordTempVariable*/ undefined);
const values = createValuesHelper(context, expression, node.expression);
const next = createCall(createPropertyAccess(iterator, "next" ), /*typeArguments*/ undefined, []);
const next = createCall(createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, []);
hoistVariableDeclaration(errorRecord);
hoistVariableDeclaration(returnMethod);

View File

@@ -216,7 +216,11 @@ namespace ts {
function visitCatchClause(node: CatchClause): CatchClause {
if (!node.variableDeclaration) {
return updateCatchClause(node, createVariableDeclaration(createTempVariable(/*recordTempVariable*/ undefined)), node.block);
return updateCatchClause(
node,
createVariableDeclaration(createTempVariable(/*recordTempVariable*/ undefined)),
visitNode(node.block, visitor, isBlock)
);
}
return visitEachChild(node, visitor, context);
}

View File

@@ -1,11 +0,0 @@
//// [emitter.ignoredCatchParameter.esnext.ts]
function fn() {
try {} catch {}
}
//// [emitter.ignoredCatchParameter.esnext.js]
function fn() {
try { }
catch { }
}

View File

@@ -1,7 +0,0 @@
=== tests/cases/conformance/emitter/esnext/noCatchParameter/emitter.ignoredCatchParameter.esnext.ts ===
function fn() {
>fn : Symbol(fn, Decl(emitter.ignoredCatchParameter.esnext.ts, 0, 0))
try {} catch {}
}

View File

@@ -1,7 +0,0 @@
=== tests/cases/conformance/emitter/esnext/noCatchParameter/emitter.ignoredCatchParameter.esnext.ts ===
function fn() {
>fn : () => void
try {} catch {}
}

View File

@@ -0,0 +1,8 @@
// @target: esnext
function f() {
try { } catch { }
try { } catch {
try { } catch { }
}
try { } catch { } finally { }
}

View File

@@ -2,11 +2,18 @@
function fn() {
try { } catch { }
try { } catch {
try { } catch {
try { } catch { }
}
try { } catch { }
}
try { } catch (x) { var x: any; }
try { } finally { }
try { } catch { } finally { }
try { } catch(z) { } finally { }
try { } catch (z) { } finally { }
}