@tishlang/tish 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/tish CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "tishlang"
3
- version = "2.0.0"
3
+ version = "2.0.1"
4
4
  edition = "2021"
5
5
  description = "Tish CLI - run, REPL, compile to native"
6
6
  license-file = { workspace = true }
@@ -1239,6 +1239,10 @@ impl Printer {
1239
1239
  self.buf.push_str("typeof ");
1240
1240
  self.child(operand, PREC_POSTFIX);
1241
1241
  }
1242
+ Expr::Delete { target, .. } => {
1243
+ self.buf.push_str("delete ");
1244
+ self.child(target, PREC_POSTFIX);
1245
+ }
1242
1246
  Expr::PostfixInc { name, .. } => {
1243
1247
  self.buf.push_str(name.as_ref());
1244
1248
  self.buf.push_str("++");
@@ -1519,6 +1523,7 @@ fn expr_prec(e: &Expr) -> u8 {
1519
1523
  Expr::Binary { op, .. } => binop_prec(*op),
1520
1524
  Expr::Unary { .. }
1521
1525
  | Expr::TypeOf { .. }
1526
+ | Expr::Delete { .. }
1522
1527
  | Expr::Await { .. }
1523
1528
  | Expr::PrefixInc { .. }
1524
1529
  | Expr::PrefixDec { .. } => 14,
@@ -2136,4 +2141,17 @@ let x = add(1, 2)
2136
2141
  let out = format_source(src).unwrap();
2137
2142
  assert_eq!(out, src, "{out:?}");
2138
2143
  }
2144
+
2145
+ #[test]
2146
+ fn formats_delete_expression() {
2147
+ // Regression: Expr::Delete (the `delete` operator) must be handled by the formatter —
2148
+ // a non-exhaustive `match` here broke the `tish-format` build once the delete feature landed.
2149
+ let src = "fn f(o, k) {\ndelete o.a\ndelete o[\"b\"]\nlet x = delete o[k]\nreturn x\n}\n";
2150
+ let out = format_source(src).unwrap();
2151
+ assert!(out.contains("delete o.a"), "{out}");
2152
+ assert!(out.contains("delete o[\"b\"]"), "{out}");
2153
+ assert!(out.contains("delete o[k]"), "{out}");
2154
+ tishlang_parser::parse(&out).unwrap();
2155
+ assert_eq!(format_source(&out).unwrap(), out, "not idempotent:\n{out}");
2156
+ }
2139
2157
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tishlang/tish",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Tish - minimal TS/JS-compatible language. Run, REPL, build to native or other targets.",
5
5
  "license": "PIF",
6
6
  "repository": {
Binary file
Binary file
Binary file
Binary file
Binary file