Skip to content

Commit

Permalink
feat: disallow 'with' statement
Browse files Browse the repository at this point in the history
  • Loading branch information
R-unic committed Sep 10, 2023
1 parent 36e6a09 commit 75f1f0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ A TypeScript to Crystal compiler. All the beauty and power of TypeScript, with a
- ignore advanced type generics (T extends, ternary operator, initializers)
- destructuring (this is so much harder than it needs to be)
- for..in
- disallow `with` statement
- polyfills:
- `String` (😭)
- `Object`
Expand Down
3 changes: 3 additions & 0 deletions src/code-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,9 @@ export default class CodeGenerator extends StringBuilder {
this.meta.inSwitchStatement = enclosingIsInSwitchStatement;
break;
}
case SyntaxKind.WithStatement: {
return this.error(node, "The 'with' statement is not supported within Crystallizer.", "UnsupportedWithStatement");
}

case SyntaxKind.ExpressionStatement: {
const statement = <ExpressionStatement>node;
Expand Down

0 comments on commit 75f1f0e

Please sign in to comment.