Skip to content

Commit 6d15954

Browse files
committed
Fixes #5564.
1 parent d88186b commit 6d15954

File tree

5 files changed

+52
-4
lines changed

5 files changed

+52
-4
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ namespace ts {
532532
}
533533

534534
// Because of module/namespace merging, a module's exports are in scope,
535-
// yet we never want to treat an export specifier as putting a member in scope.
535+
// yet we never want to treat an export specifier as putting a member in scope.
536536
// Therefore, if the name we find is purely an export specifier, it is not actually considered in scope.
537537
// Two things to note about this:
538538
// 1. We have to check this without calling getSymbol. The problem with calling getSymbol
@@ -11398,7 +11398,7 @@ namespace ts {
1139811398
// we can get here in two cases
1139911399
// 1. mixed static and instance class members
1140011400
// 2. something with the same name was defined before the set of overloads that prevents them from merging
11401-
// here we'll report error only for the first case since for second we should already report error in binder
11401+
// here we'll report error only for the first case since for second we should already report error in binder
1140211402
if (reportError) {
1140311403
const diagnostic = node.flags & NodeFlags.Static ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
1140411404
error(errorNode, diagnostic);
@@ -12065,8 +12065,8 @@ namespace ts {
1206512065
const symbol = getSymbolOfNode(node);
1206612066
const localSymbol = node.localSymbol || symbol;
1206712067

12068-
// Since the javascript won't do semantic analysis like typescript,
12069-
// if the javascript file comes before the typescript file and both contain same name functions,
12068+
// Since the javascript won't do semantic analysis like typescript,
12069+
// if the javascript file comes before the typescript file and both contain same name functions,
1207012070
// checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function.
1207112071
const firstDeclaration = forEach(localSymbol.declarations,
1207212072
// Get first non javascript function declaration
@@ -14321,6 +14321,7 @@ namespace ts {
1432114321
emitExtends = false;
1432214322
emitDecorate = false;
1432314323
emitParam = false;
14324+
emitAwaiter = false;
1432414325
potentialThisCollisions.length = 0;
1432514326

1432614327
forEach(node.statements, checkSourceElement);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//// [tests/cases/conformance/async/es6/asyncMultiFile.ts] ////
2+
3+
//// [a.ts]
4+
async function f() {}
5+
//// [b.ts]
6+
function g() { }
7+
8+
//// [a.js]
9+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
10+
return new Promise(function (resolve, reject) {
11+
generator = generator.call(thisArg, _arguments);
12+
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
13+
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
14+
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
15+
function step(verb, value) {
16+
var result = generator[verb](value);
17+
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
18+
}
19+
step("next", void 0);
20+
});
21+
};
22+
function f() {
23+
return __awaiter(this, void 0, Promise, function* () { });
24+
}
25+
//// [b.js]
26+
function g() { }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=== tests/cases/conformance/async/es6/a.ts ===
2+
async function f() {}
3+
>f : Symbol(f, Decl(a.ts, 0, 0))
4+
5+
=== tests/cases/conformance/async/es6/b.ts ===
6+
function g() { }
7+
>g : Symbol(g, Decl(b.ts, 0, 0))
8+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
=== tests/cases/conformance/async/es6/a.ts ===
2+
async function f() {}
3+
>f : () => Promise<void>
4+
5+
=== tests/cases/conformance/async/es6/b.ts ===
6+
function g() { }
7+
>g : () => void
8+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// @target: es6
2+
// @filename: a.ts
3+
async function f() {}
4+
// @filename: b.ts
5+
function g() { }

0 commit comments

Comments
 (0)