Skip to content

Commit c441afd

Browse files
authored
Throw unimplemented error when using spread operator (#1926)
* Add unimplemented error when using spread (...) * Error in resolver only with proper ReportMode * Add name and email to NOTICE * Change my email in NOTICE Co-authored-by: romdotdog <[email protected]>
1 parent 5eebd2f commit c441afd

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

NOTICE

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ under the licensing terms detailed in LICENSE:
3939
* bnbarak <[email protected]>
4040
* Colin Eberhardt <[email protected]>
4141
* Ryan Pivovar <[email protected]>
42+
* Roman F. <[email protected]>
4243
* Joe Pea <[email protected]>
4344

4445
Portions of this software are derived from third-party works licensed under

src/compiler.ts

+7
Original file line numberDiff line numberDiff line change
@@ -9745,6 +9745,13 @@ export class Compiler extends DiagnosticEmitter {
97459745
case Token.TYPEOF: {
97469746
return this.compileTypeof(expression, contextualType, constraints);
97479747
}
9748+
case Token.DOT_DOT_DOT: {
9749+
this.error(
9750+
DiagnosticCode.Not_implemented_0,
9751+
expression.range, "Spread operator"
9752+
);
9753+
return module.unreachable();
9754+
}
97489755
default: {
97499756
assert(false);
97509757
return module.unreachable();

src/resolver.ts

+9
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,15 @@ export class Resolver extends DiagnosticEmitter {
17681768
}
17691769
return type.intType;
17701770
}
1771+
case Token.DOT_DOT_DOT: {
1772+
if (reportMode == ReportMode.REPORT) {
1773+
this.error(
1774+
DiagnosticCode.Not_implemented_0,
1775+
node.range, "Spread operator"
1776+
);
1777+
}
1778+
return null;
1779+
}
17711780
default: assert(false);
17721781
}
17731782
return null;

0 commit comments

Comments
 (0)