@fairfox/polly 0.12.2 → 0.12.4

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.
@@ -78,6 +78,7 @@ export declare class HandlerExtractor {
78
78
  * Handles:
79
79
  * - Simple assignments: state.field = value
80
80
  * - Compound operators: state.count += 1
81
+ * - Unary operators: state.count++, state.count--, ++state.count, --state.count
81
82
  * - Array mutations: state.items.push(item)
82
83
  * - Array indexing: state.items[0] = value
83
84
  */
@@ -102,6 +103,10 @@ export declare class HandlerExtractor {
102
103
  * Extract compound assignments (+=, -=, *=, /=, %=)
103
104
  */
104
105
  private extractCompoundAssignment;
106
+ /**
107
+ * Extract unary expression assignments (++, --)
108
+ */
109
+ private extractUnaryExpressionAssignment;
105
110
  /**
106
111
  * Extract array mutation assignments (push, pop, shift, unshift, splice)
107
112
  */
@@ -5703,6 +5703,9 @@ class HandlerExtractor {
5703
5703
  if (Node4.isCallExpression(node)) {
5704
5704
  this.extractArrayMutationAssignment(node, assignments);
5705
5705
  }
5706
+ if (Node4.isPostfixUnaryExpression(node) || Node4.isPrefixUnaryExpression(node)) {
5707
+ this.extractUnaryExpressionAssignment(node, assignments);
5708
+ }
5706
5709
  });
5707
5710
  }
5708
5711
  extractBinaryExpressionAssignment(node, assignments) {
@@ -5778,6 +5781,23 @@ class HandlerExtractor {
5778
5781
  }
5779
5782
  }
5780
5783
  }
5784
+ extractUnaryExpressionAssignment(node, assignments) {
5785
+ if (!Node4.isPostfixUnaryExpression(node) && !Node4.isPrefixUnaryExpression(node))
5786
+ return;
5787
+ const operator = node.getOperatorToken();
5788
+ const operatorText = operator.toString();
5789
+ if (operatorText !== "++" && operatorText !== "--")
5790
+ return;
5791
+ const operand = node.getOperand();
5792
+ if (!Node4.isPropertyAccessExpression(operand))
5793
+ return;
5794
+ const fieldPath = this.getPropertyPath(operand);
5795
+ if (fieldPath.startsWith("state.")) {
5796
+ const field = fieldPath.substring(6);
5797
+ const value = operatorText === "++" ? "@ + 1" : "@ - 1";
5798
+ assignments.push({ field, value });
5799
+ }
5800
+ }
5781
5801
  extractArrayMutationAssignment(node, assignments) {
5782
5802
  if (!Node4.isCallExpression(node))
5783
5803
  return;
@@ -9579,4 +9599,4 @@ Goodbye!`);
9579
9599
  }
9580
9600
  main();
9581
9601
 
9582
- //# debugId=770FFA3847E6590364756E2164756E21
9602
+ //# debugId=8B445D057C1E5F1464756E2164756E21