@danielx/civet 0.4.26 → 0.4.27

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/README.md CHANGED
@@ -118,13 +118,11 @@ Civet.
118
118
  - `for ... when <condition>` (use `continue if exp` inside loop, `"civet coffeeCompat"`, or `"civet coffeeForLoops"`)
119
119
  - `a ? b` (use `a ?? b`, though it doesn't check for undeclared variables, `"civet coffeeCompat"`, or `"civet coffeeBinaryExistential"` enables this at the cost of losing JS ternary operator)
120
120
  - `a of b` (use `a in b` matching JS, or `"civet coffeeCompat"`, or `"civet coffeeOf"`)
121
- - Iteration expression results
122
121
  - Backtick embedded JS (replaced by template literals)
123
122
  - Will likely add later
124
123
  - Optional assignment `x?.y = 3` -> `x != null ? x.y = 3 : undefined`
125
124
  - Conditional assignment `a?[x] = 3` -> `a ? a[x] = 3 : undefined`
126
125
  - Might add later
127
- - Rest parameter in any assignment position
128
126
  - Multiple slice assignment `otherNumbers[0...] = numbers[3..6] = [-3, -4, -5, -6]`
129
127
 
130
128
  Things Changed from CoffeeScript
@@ -242,6 +240,8 @@ could be a valid property `1.e10` -> `1..e10`. The workaround is to add a traili
242
240
  @@methodDecorator
243
241
  method() {}
244
242
  ```
243
+ - `when` inside switch automatically breaks and adds block scope.
244
+ - `else` inside switch adds block scope.
245
245
  - No whitespace between unary operators and operands. Mandatory whitespace between condition and ternary `?` ex. `x ? a : b` since `x?` is the unary existential operator.
246
246
  - No labels (yet...)
247
247
 
package/dist/browser.js CHANGED
@@ -6517,9 +6517,10 @@ ${input.slice(result.pos)}
6517
6517
  var expressions = value[2];
6518
6518
  return { "type": "CaseClause", "cases": cases, "expressions": expressions, "children": value };
6519
6519
  });
6520
- var CaseClause$1 = $TS($S(When, CaseExpressionList, $C(ThenClause, NestedBlockStatements), InsertBreak), function($skip, $loc, $0, $1, $2, $3, $4) {
6520
+ var CaseClause$1 = $TS($S(When, CaseExpressionList, InsertOpenBrace, $C(ThenClause, NestedBlockStatements), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
6521
6521
  var cases = $2;
6522
- var expressions = $3;
6522
+ var expressions = $4;
6523
+ var b = $5;
6523
6524
  if (expressions.expressions) {
6524
6525
  expressions = expressions.expressions;
6525
6526
  }
@@ -6527,6 +6528,7 @@ ${input.slice(result.pos)}
6527
6528
  type: "WhenClause",
6528
6529
  cases,
6529
6530
  expressions,
6531
+ break: b,
6530
6532
  children: $0
6531
6533
  };
6532
6534
  });
@@ -6540,8 +6542,8 @@ ${input.slice(result.pos)}
6540
6542
  children: $0
6541
6543
  };
6542
6544
  });
6543
- var CaseClause$3 = $TS($S(Else, ImpliedColon, $C(NestedBlockStatements, $S($Q(TrailingComment), Statement))), function($skip, $loc, $0, $1, $2, $3) {
6544
- var expressions = $3;
6545
+ var CaseClause$3 = $TS($S(Else, ImpliedColon, InsertOpenBrace, $C(NestedBlockStatements, $S($Q(TrailingComment), Statement)), InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
6546
+ var expressions = $4;
6545
6547
  $1.token = "default";
6546
6548
  if (expressions.expressions)
6547
6549
  expressions = expressions.expressions;
@@ -12419,7 +12421,7 @@ ${input.slice(result.pos)}
12419
12421
  case "CaseClause":
12420
12422
  return;
12421
12423
  case "WhenClause":
12422
- node.children.pop();
12424
+ node.children.splice(node.children.indexOf(node.break), 1);
12423
12425
  insertReturn(node.expressions[node.expressions.length - 1]);
12424
12426
  return;
12425
12427
  case "DefaultClause":
package/dist/main.js CHANGED
@@ -6516,9 +6516,10 @@ ${input.slice(result.pos)}
6516
6516
  var expressions = value[2];
6517
6517
  return { "type": "CaseClause", "cases": cases, "expressions": expressions, "children": value };
6518
6518
  });
6519
- var CaseClause$1 = $TS($S(When, CaseExpressionList, $C(ThenClause, NestedBlockStatements), InsertBreak), function($skip, $loc, $0, $1, $2, $3, $4) {
6519
+ var CaseClause$1 = $TS($S(When, CaseExpressionList, InsertOpenBrace, $C(ThenClause, NestedBlockStatements), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
6520
6520
  var cases = $2;
6521
- var expressions = $3;
6521
+ var expressions = $4;
6522
+ var b = $5;
6522
6523
  if (expressions.expressions) {
6523
6524
  expressions = expressions.expressions;
6524
6525
  }
@@ -6526,6 +6527,7 @@ ${input.slice(result.pos)}
6526
6527
  type: "WhenClause",
6527
6528
  cases,
6528
6529
  expressions,
6530
+ break: b,
6529
6531
  children: $0
6530
6532
  };
6531
6533
  });
@@ -6539,8 +6541,8 @@ ${input.slice(result.pos)}
6539
6541
  children: $0
6540
6542
  };
6541
6543
  });
6542
- var CaseClause$3 = $TS($S(Else, ImpliedColon, $C(NestedBlockStatements, $S($Q(TrailingComment), Statement))), function($skip, $loc, $0, $1, $2, $3) {
6543
- var expressions = $3;
6544
+ var CaseClause$3 = $TS($S(Else, ImpliedColon, InsertOpenBrace, $C(NestedBlockStatements, $S($Q(TrailingComment), Statement)), InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
6545
+ var expressions = $4;
6544
6546
  $1.token = "default";
6545
6547
  if (expressions.expressions)
6546
6548
  expressions = expressions.expressions;
@@ -12418,7 +12420,7 @@ ${input.slice(result.pos)}
12418
12420
  case "CaseClause":
12419
12421
  return;
12420
12422
  case "WhenClause":
12421
- node.children.pop();
12423
+ node.children.splice(node.children.indexOf(node.break), 1);
12422
12424
  insertReturn(node.expressions[node.expressions.length - 1]);
12423
12425
  return;
12424
12426
  case "DefaultClause":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.4.26",
3
+ "version": "0.4.27",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "exports": {