Skip to content

Commit 160c429

Browse files
committed
if metadata is a fixed array, then it can more easily be destructured into class attributes saving file size
1 parent 1eca28a commit 160c429

227 files changed

Lines changed: 237 additions & 460 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/slang-nodes/AbicoderPragma.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ export class AbicoderPragma implements SlangNode {
2020

2121
this.version = new Identifier(ast.version);
2222

23-
this.comments = metadata.comments;
24-
this.loc = metadata.loc;
23+
[this.loc, this.comments] = metadata;
2524
}
2625

2726
print(path: AstPath<AbicoderPragma>, print: PrintFunction): Doc {

src/slang-nodes/AdditiveExpression.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ export class AdditiveExpression implements SlangNode {
4747

4848
metadata = updateMetadata(metadata, [this.leftOperand, this.rightOperand]);
4949

50-
this.comments = metadata.comments;
51-
this.loc = metadata.loc;
50+
[this.loc, this.comments] = metadata;
5251

5352
this.leftOperand = tryToHug(this.leftOperand);
5453
this.rightOperand = tryToHug(this.rightOperand);

src/slang-nodes/AddressType.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ export class AddressType implements SlangNode {
2020

2121
this.payableKeyword = ast.payableKeyword?.unparse();
2222

23-
this.comments = metadata.comments;
24-
this.loc = metadata.loc;
23+
[this.loc, this.comments] = metadata;
2524
}
2625

2726
print(): Doc {

src/slang-nodes/AndExpression.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ export class AndExpression implements SlangNode {
3030

3131
metadata = updateMetadata(metadata, [this.leftOperand, this.rightOperand]);
3232

33-
this.comments = metadata.comments;
34-
this.loc = metadata.loc;
33+
[this.loc, this.comments] = metadata;
3534
}
3635

3736
print(

src/slang-nodes/ArgumentsDeclaration.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ export class ArgumentsDeclaration implements SlangNode {
3939

4040
metadata = updateMetadata(metadata, [this.variant]);
4141

42-
this.comments = metadata.comments;
43-
this.loc = metadata.loc;
42+
[this.loc, this.comments] = metadata;
4443
}
4544

4645
print(path: AstPath<ArgumentsDeclaration>, print: PrintFunction): Doc {

src/slang-nodes/ArrayExpression.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ export class ArrayExpression implements SlangNode {
2626

2727
metadata = updateMetadata(metadata, [this.items]);
2828

29-
this.comments = metadata.comments;
30-
this.loc = metadata.loc;
29+
[this.loc, this.comments] = metadata;
3130
}
3231

3332
print(path: AstPath<ArrayExpression>, print: PrintFunction): Doc {

src/slang-nodes/ArrayTypeName.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ export class ArrayTypeName implements SlangNode {
2929

3030
metadata = updateMetadata(metadata, [this.operand, this.index]);
3131

32-
this.comments = metadata.comments;
33-
this.loc = metadata.loc;
32+
[this.loc, this.comments] = metadata;
3433
}
3534

3635
print(path: AstPath<ArrayTypeName>, print: PrintFunction): Doc {

src/slang-nodes/ArrayValues.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ export class ArrayValues implements SlangNode {
2424

2525
metadata = updateMetadata(metadata, [this.items]);
2626

27-
this.comments = metadata.comments;
28-
this.loc = metadata.loc;
27+
[this.loc, this.comments] = metadata;
2928
}
3029

3130
print(path: AstPath<ArrayValues>, print: PrintFunction): Doc {

src/slang-nodes/AssemblyFlags.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ export class AssemblyFlags implements SlangNode {
2424

2525
metadata = updateMetadata(metadata, [this.items]);
2626

27-
this.comments = metadata.comments;
28-
this.loc = metadata.loc;
27+
[this.loc, this.comments] = metadata;
2928
}
3029

3130
print(path: AstPath<AssemblyFlags>, print: PrintFunction): Doc {

src/slang-nodes/AssemblyFlagsDeclaration.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ export class AssemblyFlagsDeclaration implements SlangNode {
2626

2727
metadata = updateMetadata(metadata, [this.flags]);
2828

29-
this.comments = metadata.comments;
30-
this.loc = metadata.loc;
29+
[this.loc, this.comments] = metadata;
3130
}
3231

3332
print(path: AstPath<AssemblyFlagsDeclaration>, print: PrintFunction): Doc {

0 commit comments

Comments
 (0)