Skip to content

Commit

Permalink
made vars counters independent of internal counters
Browse files Browse the repository at this point in the history
  • Loading branch information
azizghuloum committed Dec 18, 2024
1 parent 2ba939e commit 2a5fde8
Show file tree
Hide file tree
Showing 36 changed files with 161 additions and 708 deletions.
567 changes: 5 additions & 562 deletions deno.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/arrow-function-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const h = (x) => x((x) => f(x));
### Output Program

```typescript
export const f_2 = (x_9) => x_9;
export const g_4 = (x_12) => f_2(x_12);
export const h_6 = (x_15) => x_15((x_18) => f_2(x_18));
export const f_1 = (x_4) => x_4;
export const g_2 = (x_5) => f_1(x_5);
export const h_3 = (x_6) => x_6((x_7) => f_1(x_7));
```

4 changes: 2 additions & 2 deletions examples/arrow-function-3.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const foo = (x) => {
### Output Program

```typescript
export const foo_2 = (x_5) => {
const bar_7 = x_5(13);
export const foo_1 = (x_2) => {
const bar_3 = x_2(13);
};
```

4 changes: 2 additions & 2 deletions examples/arrow-function-4.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const foo = (x) => {
### Output Program

```typescript
export const foo_2 = (x_5) => {
x_5;
export const foo_1 = (x_2) => {
x_2;
};
```

4 changes: 2 additions & 2 deletions examples/arrow-function-5.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const foo = (x) => {
### Output Program

```typescript
export const foo_2 = (x_5) => {
x_5;
export const foo_1 = (x_2) => {
x_2;
};
```

6 changes: 3 additions & 3 deletions examples/confused-parens-with-calls.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const foo = (x) => {
### Output Program

```typescript
export const foo_2 = (x_5) => {
x_5;
x_5;
export const foo_1 = (x_2) => {
x_2;
x_2;
};
```

2 changes: 1 addition & 1 deletion examples/curry-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ using_rewrite_rules(
### Output Program

```typescript
(a_6) => (b_10) => (c_14) => (d_18) => a_6 + b_10 + c_14 + d_18;
(a_1) => (b_2) => (c_3) => (d_4) => a_1 + b_2 + c_3 + d_4;
```

2 changes: 1 addition & 1 deletion examples/curry-2.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ const curried =
### Output Program

```typescript
export const curried_3 = (a_7) => (b_11) => (c_15) => (d_19) => a_7 + b_11 + c_15 + d_19;
export const curried_1 = (a_2) => (b_3) => (c_4) => (d_5) => a_2 + b_3 + c_4 + d_5;
```

4 changes: 2 additions & 2 deletions examples/export-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ x;
### Output Program

```typescript
export const x_2 = 12;
x_2;
export const x_1 = 12;
x_1;
```

2 changes: 1 addition & 1 deletion examples/expr-dot-where.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ console.log(x + y).where(x = 1, y = x + 2);
### Output Program

```typescript
((x_5) => ((y_9) => console.log(x_5 + y_9))(x_5 + 2))(1);
((x_1) => ((y_2) => console.log(x_1 + y_2))(x_1 + 2))(1);
```

4 changes: 2 additions & 2 deletions examples/implicit-and-explicit-type-exports.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type explicitly_exported_type = number; // this should stay exported in t
### Output Program

```typescript
export type not_explicitly_exported_type_2 = string;
export type explicitly_exported_type_4 = number;
export type not_explicitly_exported_type_1 = string;
export type explicitly_exported_type_2 = number;
```

14 changes: 7 additions & 7 deletions examples/lexical-declarations-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export const x = (z) => {
### Output Program

```typescript
export type t_2 = 12;
export const y_4 = 13,
z_6: t_2 = y_4,
q_8: t_2,
r_10;
export const x_12 = (z_15) => {
const t_17 = z_15;
export type t_1 = 12;
export const y_2 = 13,
z_3: t_1 = y_2,
q_4: t_1,
r_5;
export const x_6 = (z_7) => {
const t_8 = z_7;
};
```

2 changes: 1 addition & 1 deletion examples/macro-generating-macro-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ using_rewrite_rules(
### Output Program

```typescript
(x_5) => (x_11) => x_11 + x_5;
(x_1) => (x_2) => x_2 + x_1;
```

6 changes: 3 additions & 3 deletions examples/macro-generating-macro-2.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ using_rewrite_rules(
### Output Program

```typescript
(x_5) => {
const using_rewrite_rules_7 = 10;
(x_13) => x_13 + x_5;
(x_1) => {
const using_rewrite_rules_2 = 10;
(x_3) => x_3 + x_1;
};
```

8 changes: 4 additions & 4 deletions examples/macro-generating-tmp-binding-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const tmp = 17; // which has nothing to do with this tmp
### Output Program

```typescript
export const x_3 = 1;
export const tmp_6 = x_3;
console.log(tmp_6);
export const tmp_8 = 17;
export const x_1 = 1;
export const tmp_2 = x_1;
console.log(tmp_2);
export const tmp_3 = 17;
```

4 changes: 2 additions & 2 deletions examples/macro-generating-type-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type b = a;
### Output Program

```typescript
export type a_5 = string;
export type b_7 = a_5;
export type a_1 = string;
export type b_2 = a_1;
```

2 changes: 1 addition & 1 deletion examples/not-test-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ using_rewrite_rules(
### Output Program

```typescript
1 ? !3 : (x_10) => !x_10;
1 ? !3 : (x_1) => !x_1;
```

8 changes: 4 additions & 4 deletions examples/splice-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const q = t + x;
### Output Program

```typescript
export const t_2 = 13;
export const x_4 = 17;
export const y_6 = x_4 + t_2;
export const q_8 = t_2 + x_4;
export const t_1 = 13;
export const x_2 = 17;
export const y_3 = x_2 + t_1;
export const q_4 = t_1 + x_2;
```

6 changes: 3 additions & 3 deletions examples/splice-2.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const foo = (x) => {
### Output Program

```typescript
export const foo_2 = (x_5) => {
x_5;
x_5;
export const foo_1 = (x_2) => {
x_2;
x_2;
};
```

4 changes: 2 additions & 2 deletions examples/test-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ x;
### Output Program

```typescript
export const x_2 = 12;
x_2;
export const x_1 = 12;
x_1;
```

4 changes: 2 additions & 2 deletions examples/test-2.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ x + x;
### Output Program

```typescript
export const x_2 = 12;
x_2 + x_2;
export const x_1 = 12;
x_1 + x_1;
```

6 changes: 3 additions & 3 deletions examples/type-alias-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ type q = number;
### Output Program

```typescript
export type t_2 = string;
export const t_4 = 12;
export type q_6 = number;
export type t_1 = string;
export const t_2 = 12;
export type q_3 = number;
```

4 changes: 2 additions & 2 deletions examples/type-associativity-1.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const q = 12 | 13 & 14 | 15
### Output Program

```typescript
export type q_2 = (number | (string & 17)) | 13;
export const q_4 = 12 | (13 & 14) | 15;
export type q_1 = (number | (string & 17)) | 13;
export const q_2 = 12 | (13 & 14) | 15;
```

4 changes: 2 additions & 2 deletions examples/using-rewrite-rules-2.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const x = 12;
### Output Program

```typescript
x_7 + x_7;
export const x_7 = 12;
x_1 + x_1;
export const x_1 = 12;
```

4 changes: 2 additions & 2 deletions examples/using-rewrite-rules-3.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const x = 12;
### Output Program

```typescript
(foo_8) => x_5 + x_5;
export const x_5 = 12;
(foo_2) => x_1 + x_1;
export const x_1 = 12;
```

4 changes: 2 additions & 2 deletions examples/using-rewrite-rules-4.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const x = 12;
### Output Program

```typescript
x_6 + ((foo_9, foo_11) => foo_11 + foo_9);
export const x_6 = 12;
x_1 + ((foo_2, foo_3) => foo_3 + foo_2);
export const x_1 = 12;
```

4 changes: 3 additions & 1 deletion src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { preexpand_helpers } from "./preexpand-helpers";
import { import_req, lexical_extension, modular_extension } from "./stx";
import { CompilationUnit, Context, Loc } from "./syntax-structures";

export type counters = { vars: number; internal: number };

export type data = {
loc: Loc;
lexical: lexical_extension;
context: Context;
counter: number;
counters: counters;
unit: CompilationUnit;
helpers: preexpand_helpers;
imp: import_req;
Expand Down
Loading

0 comments on commit 2a5fde8

Please sign in to comment.