mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
98 lines
3.7 KiB
Plaintext
98 lines
3.7 KiB
Plaintext
//// [tests/cases/conformance/controlFlow/constLocalsInFunctionExpressions.ts] ////
|
|
|
|
=== constLocalsInFunctionExpressions.ts ===
|
|
declare function getStringOrNumber(): string | number;
|
|
>getStringOrNumber : Symbol(getStringOrNumber, Decl(constLocalsInFunctionExpressions.ts, 0, 0))
|
|
|
|
function f1() {
|
|
>f1 : Symbol(f1, Decl(constLocalsInFunctionExpressions.ts, 0, 54))
|
|
|
|
const x = getStringOrNumber();
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 3, 9))
|
|
>getStringOrNumber : Symbol(getStringOrNumber, Decl(constLocalsInFunctionExpressions.ts, 0, 0))
|
|
|
|
if (typeof x === "string") {
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 3, 9))
|
|
|
|
const f = () => x.length;
|
|
>f : Symbol(f, Decl(constLocalsInFunctionExpressions.ts, 5, 13))
|
|
>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 3, 9))
|
|
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
|
}
|
|
}
|
|
|
|
function f2() {
|
|
>f2 : Symbol(f2, Decl(constLocalsInFunctionExpressions.ts, 7, 1))
|
|
|
|
const x = getStringOrNumber();
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 10, 9))
|
|
>getStringOrNumber : Symbol(getStringOrNumber, Decl(constLocalsInFunctionExpressions.ts, 0, 0))
|
|
|
|
if (typeof x !== "string") {
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 10, 9))
|
|
|
|
return;
|
|
}
|
|
const f = () => x.length;
|
|
>f : Symbol(f, Decl(constLocalsInFunctionExpressions.ts, 14, 9))
|
|
>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 10, 9))
|
|
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
|
}
|
|
|
|
function f3() {
|
|
>f3 : Symbol(f3, Decl(constLocalsInFunctionExpressions.ts, 15, 1))
|
|
|
|
const x = getStringOrNumber();
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 18, 9))
|
|
>getStringOrNumber : Symbol(getStringOrNumber, Decl(constLocalsInFunctionExpressions.ts, 0, 0))
|
|
|
|
if (typeof x === "string") {
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 18, 9))
|
|
|
|
const f = function() { return x.length; };
|
|
>f : Symbol(f, Decl(constLocalsInFunctionExpressions.ts, 20, 13))
|
|
>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 18, 9))
|
|
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
|
}
|
|
}
|
|
|
|
function f4() {
|
|
>f4 : Symbol(f4, Decl(constLocalsInFunctionExpressions.ts, 22, 1))
|
|
|
|
const x = getStringOrNumber();
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 25, 9))
|
|
>getStringOrNumber : Symbol(getStringOrNumber, Decl(constLocalsInFunctionExpressions.ts, 0, 0))
|
|
|
|
if (typeof x !== "string") {
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 25, 9))
|
|
|
|
return;
|
|
}
|
|
const f = function() { return x.length; };
|
|
>f : Symbol(f, Decl(constLocalsInFunctionExpressions.ts, 29, 9))
|
|
>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 25, 9))
|
|
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
|
}
|
|
|
|
function f5() {
|
|
>f5 : Symbol(f5, Decl(constLocalsInFunctionExpressions.ts, 30, 1))
|
|
|
|
const x = getStringOrNumber();
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 33, 9))
|
|
>getStringOrNumber : Symbol(getStringOrNumber, Decl(constLocalsInFunctionExpressions.ts, 0, 0))
|
|
|
|
if (typeof x === "string") {
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 33, 9))
|
|
|
|
const f = () => () => x.length;
|
|
>f : Symbol(f, Decl(constLocalsInFunctionExpressions.ts, 35, 13))
|
|
>x.length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
|
>x : Symbol(x, Decl(constLocalsInFunctionExpressions.ts, 33, 9))
|
|
>length : Symbol(String.length, Decl(lib.es5.d.ts, --, --))
|
|
}
|
|
}
|