Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw unimplemented error when using spread operator #1926

Merged
merged 5 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ under the licensing terms detailed in LICENSE:
* bnbarak <bn.barak@gmail.com>
* Colin Eberhardt <colin.eberhardt@gmail.com>
* Ryan Pivovar <ryanpivovar@gmail.com>
* Roman F. <70765447+romdotdog@users.noreply.github.com>
* Joe Pea <trusktr@gmail.com>

Portions of this software are derived from third-party works licensed under
Expand Down
7 changes: 7 additions & 0 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9745,6 +9745,13 @@ export class Compiler extends DiagnosticEmitter {
case Token.TYPEOF: {
return this.compileTypeof(expression, contextualType, constraints);
}
case Token.DOT_DOT_DOT: {
this.error(
DiagnosticCode.Not_implemented_0,
expression.range, "Spread operator"
);
return module.unreachable();
}
default: {
assert(false);
return module.unreachable();
Expand Down
9 changes: 9 additions & 0 deletions src/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,15 @@ export class Resolver extends DiagnosticEmitter {
}
return type.intType;
}
case Token.DOT_DOT_DOT: {
if (reportMode == ReportMode.REPORT) {
this.error(
DiagnosticCode.Not_implemented_0,
node.range, "Spread operator"
);
}
return null;
}
default: assert(false);
}
return null;
Expand Down